Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#293] Mob timer should work anywhere on the system #295

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 3.1.5
- Add a more specific error message if `git` is not installed.
- Allow for using `mob timer` outside of git repositories.
- Fix: `mob done --squash-wip` now successfully auto-merges auto-mergeable diverging changes.
- Print the help output whenever any kind of help argument (`help`, `--help`, `-h`) is present in the command, e.g. `mob s 10 -h`.
- Various fixes in suggestion of next typist:
Expand Down
27 changes: 19 additions & 8 deletions mob.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,22 +951,33 @@ func startTimer(timerInMinutes string, configuration Configuration) {
}

func getMobTimerRoom(configuration Configuration) string {
currentWipBranchQualifier := configuration.WipBranchQualifier
if currentWipBranchQualifier == "" {
if !isGit() {
debugInfo("timer not in git repository, using MOB_TIMER_ROOM for room name")
return configuration.TimerRoom
}

currentWipBranchQualifier := getCurrentWipBranchQualifier(configuration)

if configuration.TimerRoomUseWipBranchQualifier && currentWipBranchQualifier != "" {
sayInfo("Using wip branch qualifier for room name")
return currentWipBranchQualifier
}

return configuration.TimerRoom
}

func getCurrentWipBranchQualifier(configuration Configuration) string {
maciej-stanuch marked this conversation as resolved.
Show resolved Hide resolved
if configuration.WipBranchQualifier == "" {
currentBranch := gitCurrentBranch()
currentBaseBranch, _ := determineBranches(currentBranch, gitBranches(), configuration)

if currentBranch.IsWipBranch(configuration) {
wipBranchWithoutWipPrefix := currentBranch.removeWipPrefix(configuration).Name
currentWipBranchQualifier = removePrefix(removePrefix(wipBranchWithoutWipPrefix, currentBaseBranch.Name), configuration.WipBranchQualifierSeparator)
return removePrefix(removePrefix(wipBranchWithoutWipPrefix, currentBaseBranch.Name), configuration.WipBranchQualifierSeparator)
}
}

if configuration.TimerRoomUseWipBranchQualifier && currentWipBranchQualifier != "" {
sayInfo("Using wip branch qualifier for room name")
return currentWipBranchQualifier
}
return configuration.TimerRoom
return configuration.WipBranchQualifier
}

func startBreakTimer(timerInMinutes string, configuration Configuration) {
Expand Down