diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-19 09:34:24 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-19 09:34:24 +1100 |
commit | 935f77483443a12ab159e19a958dfdf61a947b36 (patch) | |
tree | d8be76e0f277d1e39e1c9cca10aa88439b3020b1 /pkg | |
parent | dcc7855fd0f04d68fa809d586ac7f45a534f7b25 (diff) |
don't autostash when editing
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/git.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index e89551fe3..845b81ff2 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -650,8 +650,8 @@ func (c *GitCommand) InteractiveRebase(commits []*Commit, index int, action stri return err } - autoStash := action != "edit" - cmd, err := c.PrepareInteractiveRebaseCommand(commits[index+1].Sha, todo, autoStash) + // TODO: decide whether to autostash when action == editing + cmd, err := c.PrepareInteractiveRebaseCommand(commits[index+1].Sha, todo, true) if err != nil { return err } @@ -670,9 +670,12 @@ func (c *GitCommand) PrepareInteractiveRebaseCommand(baseSha string, todo string debug = "TRUE" } - // we do not want to autostash if we are editing + autoStashFlag := "" + if autoStash { + autoStashFlag = "--autostash" + } - splitCmd := str.ToArgv(fmt.Sprintf("git rebase --interactive --autostash %s", baseSha)) + splitCmd := str.ToArgv(fmt.Sprintf("git rebase --interactive %s %s", autoStashFlag, baseSha)) cmd := exec.Command(splitCmd[0], splitCmd[1:]...) |