Skip to content

Commit

Permalink
Release 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
simonharrer committed Aug 17, 2021
1 parent 53c06c2 commit 28502bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 1.9.0
- Show commit hash of WIP commits made by the `mob` tool on the console.
- `mob start --include-uncommitted-changes` now fails fast. That means, if `mob` can detect any issue preventing it to succeed, it will exit BEFORE calling `git stash`. This will make error recovery much easier as one doesn't have to think about applying any stashes by themselves.

# 1.8.0
- `mob next` does not show the same committer multiple times in the list of previous committers.
Expand Down
27 changes: 13 additions & 14 deletions mob.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
versionNumber = "1.8.0"
versionNumber = "1.9.0"
mobStashName = "mob-stash-name"
)

Expand Down Expand Up @@ -590,18 +590,13 @@ func reset(configuration Configuration) {
}

func start(configuration Configuration) error {
stashed := false
if hasUncommittedChanges() {
if configuration.MobStartIncludeUncommittedChanges {
git("stash", "push", "--include-untracked", "--message", mobStashName)
stashed = true
} else {
sayInfo("cannot start; clean working tree required")
sayUnstagedChangesInfo()
sayUntrackedFilesInfo()
sayTodo("To start, including uncommitted changes, use", "mob start --include-uncommitted-changes")
return errors.New("cannot start; clean working tree required")
}
uncommittedChanges := hasUncommittedChanges()
if uncommittedChanges && !configuration.MobStartIncludeUncommittedChanges {
sayInfo("cannot start; clean working tree required")
sayUnstagedChangesInfo()
sayUntrackedFilesInfo()
sayTodo("To start, including uncommitted changes, use", "mob start --include-uncommitted-changes")
return errors.New("cannot start; clean working tree required")
}

git("fetch", configuration.RemoteName, "--prune")
Expand All @@ -618,6 +613,10 @@ func start(configuration Configuration) error {
return errors.New("cannot start; unpushed changes on base branch must be pushed upstream")
}

if uncommittedChanges {
git("stash", "push", "--include-untracked", "--message", mobStashName)
}

if !isMobProgramming(configuration) {
git("merge", "FETCH_HEAD", "--ff-only")
}
Expand All @@ -630,7 +629,7 @@ func start(configuration Configuration) error {
startNewMobSession(configuration)
}

if configuration.MobStartIncludeUncommittedChanges && stashed {
if uncommittedChanges && configuration.MobStartIncludeUncommittedChanges {
stashes := silentgit("stash", "list")
stash := findLatestMobStash(stashes)
git("stash", "pop", stash)
Expand Down

0 comments on commit 28502bf

Please sign in to comment.