diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-03-02 20:00:26 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-03-02 20:00:26 +1100 |
commit | 0c886eddfb429f31352d0908fe993d415d7d3709 (patch) | |
tree | 00ded3a52ba73d1d200af9dd6cf5c9fdfd6ef3a2 /pkg/commands | |
parent | 399346c2eef5d4e40e9c3b5252addd3dbb5b3598 (diff) |
Revert "remove old rebase code now that we're only ever interactively rebasing"
This reverts commit 1a19b1412d3da03992403cf62fddf06031de2927.
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 711215d3b..ecfd86eb2 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -419,9 +419,22 @@ func (c *GitCommand) IsInMergeState() (bool, error) { return strings.Contains(output, "conclude merge") || strings.Contains(output, "unmerged paths"), nil } -// IsInRebasingState tells us if we are rebasing -func (c *GitCommand) IsInRebasingState() (bool, error) { - return c.OSCommand.FileExists(".git/rebase-merge") +// RebaseMode returns "" for non-rebase mode, "normal" for normal rebase +// and "interactive" for interactive rebase +func (c *GitCommand) RebaseMode() (string, error) { + exists, err := c.OSCommand.FileExists(".git/rebase-apply") + if err != nil { + return "", err + } + if exists { + return "normal", nil + } + exists, err = c.OSCommand.FileExists(".git/rebase-merge") + if exists { + return "interactive", err + } else { + return "", err + } } // RemoveFile directly |