diff options
Diffstat (limited to 'pkg/commands/status.go')
-rw-r--r-- | pkg/commands/status.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pkg/commands/status.go b/pkg/commands/status.go index c5a6c2526..c11fe829f 100644 --- a/pkg/commands/status.go +++ b/pkg/commands/status.go @@ -6,6 +6,13 @@ import ( gogit "github.com/jesseduffield/go-git/v5" ) +const ( + REBASE_MODE_NORMAL = "normal" + REBASE_MODE_INTERACTIVE = "interactive" + REBASE_MODE_REBASING = "rebasing" + REBASE_MODE_MERGING = "merging" +) + // RebaseMode returns "" for non-rebase mode, "normal" for normal rebase // and "interactive" for interactive rebase func (c *GitCommand) RebaseMode() (string, error) { @@ -14,11 +21,11 @@ func (c *GitCommand) RebaseMode() (string, error) { return "", err } if exists { - return "normal", nil + return REBASE_MODE_NORMAL, nil } exists, err = c.OSCommand.FileExists(filepath.Join(c.DotGitDir, "rebase-merge")) if exists { - return "interactive", err + return REBASE_MODE_INTERACTIVE, err } else { return "", err } @@ -27,13 +34,13 @@ func (c *GitCommand) RebaseMode() (string, error) { func (c *GitCommand) WorkingTreeState() string { rebaseMode, _ := c.RebaseMode() if rebaseMode != "" { - return "rebasing" + return REBASE_MODE_REBASING } merging, _ := c.IsInMergeState() if merging { - return "merging" + return REBASE_MODE_MERGING } - return "normal" + return REBASE_MODE_NORMAL } // IsInMergeState states whether we are still mid-merge |