From 7a7e88577341f314ff54ef50474390f1f94d4b91 Mon Sep 17 00:00:00 2001 From: Glenn Vriesman Date: Sun, 2 Dec 2018 17:33:16 +0100 Subject: [PATCH] Added rebase support commands --- pkg/commands/git.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 2b5044971..bbd388303 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -269,6 +269,10 @@ func (c *GitCommand) RebaseBranch(onto string) error { return c.OSCommand.RunCommand(fmt.Sprintf("git rebase %s %s ", onto, curBranch)) } +func (c *GitCommand) ContinueRebaseBranch() error { + return c.OSCommand.RunCommand("git rebase --continue") +} + func (c *GitCommand) AbortRebaseBranch() error { return c.OSCommand.RunCommand("git rebase --abort") } @@ -450,6 +454,14 @@ func (c *GitCommand) IsInMergeState() (bool, error) { return strings.Contains(output, "conclude merge") || strings.Contains(output, "unmerged paths"), nil } +func (c *GitCommand) IsInRebaseState() (bool, error) { + output, err := c.OSCommand.RunCommandWithOutput("git status --untracked-files=all") + if err != nil { + return false, err + } + return strings.Contains(output, "rebase in progress"), nil +} + // RemoveFile directly func (c *GitCommand) RemoveFile(file *File) error { // if the file isn't tracked, we assume you want to delete it