diff --git a/pkg/commands/git_commands/sync.go b/pkg/commands/git_commands/sync.go index 603e5b8eb..59f052db8 100644 --- a/pkg/commands/git_commands/sync.go +++ b/pkg/commands/git_commands/sync.go @@ -111,7 +111,19 @@ func (self *SyncCommands) Pull(task gocui.Task, opts PullOptions) error { // setting GIT_SEQUENCE_EDITOR to ':' as a way of skipping it, in case the user // has 'pull.rebase = interactive' configured. - return self.cmd.New(cmdArgs).AddEnvVars("GIT_SEQUENCE_EDITOR=:").PromptOnCredentialRequest(task).Run() + cmdObj := self.cmd.New(cmdArgs).AddEnvVars("GIT_SEQUENCE_EDITOR=:").PromptOnCredentialRequest(task) + + // With pull.rebase set, a lock error can stop the pull partway through its + // rebase. + gitDir := lo.Ternary(opts.WorktreeGitDir != "", opts.WorktreeGitDir, self.repoPaths.WorktreeGitDirPath()) + return resumeRebaseAfterLockError(cmdObj, gitDir, self.config.GetCoreCommentChar(), func() *oscommands.CmdObj { + continueArgs := NewGitCmd("rebase"). + Arg("--continue"). + GitDirIf(opts.WorktreeGitDir != "", opts.WorktreeGitDir). + WorktreePathIf(opts.WorktreePath != "", opts.WorktreePath). + ToArgv() + return skipEditor(self.cmd.New(continueArgs)) + }).Run() } // Fetches the given branches of the given remote, updating their diff --git a/pkg/integration/tests/sync/lock_error_partway_through_pull_with_rebase.go b/pkg/integration/tests/sync/lock_error_partway_through_pull_with_rebase.go index 273f3e9fd..3135dd8b2 100644 --- a/pkg/integration/tests/sync/lock_error_partway_through_pull_with_rebase.go +++ b/pkg/integration/tests/sync/lock_error_partway_through_pull_with_rebase.go @@ -49,7 +49,6 @@ var LockErrorPartwayThroughPullWithRebase = NewIntegrationTest(NewIntegrationTes IsFocused(). Press(keys.Universal.Pull) - /* EXPECTED: t.Views().Status().Content(Equals("↑2 repo → master")) t.Views().Commits(). @@ -60,21 +59,5 @@ var LockErrorPartwayThroughPullWithRebase = NewIntegrationTest(NewIntegrationTes Contains("two"), Contains("one"), ) - ACTUAL: */ - t.ExpectPopup().Alert(). - Title(Equals("Error")). - Content(Contains("You are not currently on a branch.")). - Confirm() - - t.Views().Commits(). - Lines( - Contains("─── Pending rebase todos"), - Contains("pick").Contains("five"), - Contains("─── Commits"), - Contains("four"), - Contains("three"), - Contains("two"), - Contains("one"), - ) }, })