diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-07-10 13:48:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 13:48:37 +0200 |
commit | f9414f275d32711dfd897c7006da3258f49c89ca (patch) | |
tree | 279b9091ca0462bb606c23347d25c65b694f3c88 | |
parent | 8f00bfebcee681477c36e7c252180cc01f6d2125 (diff) | |
parent | cc316ab6de40c3b6fd3666b5ce0241eeee4680e8 (diff) |
Fix interactive rebase with git 2.25.1 and earlier (#2747)
-rw-r--r-- | pkg/commands/git_commands/commit_loader.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 148c96776..32d470fc8 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -222,11 +222,24 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode return nil, err } + findFullCommit := lo.Ternary(self.version.IsOlderThan(2, 25, 2), + func(sha string) *models.Commit { + for s, c := range fullCommits { + if strings.HasPrefix(s, sha) { + return c + } + } + return nil + }, + func(sha string) *models.Commit { + return fullCommits[sha] + }) + hydratedCommits := make([]*models.Commit, 0, len(commits)) for _, rebasingCommit := range commits { if rebasingCommit.Sha == "" { hydratedCommits = append(hydratedCommits, rebasingCommit) - } else if commit := fullCommits[rebasingCommit.Sha]; commit != nil { + } else if commit := findFullCommit(rebasingCommit.Sha); commit != nil { commit.Action = rebasingCommit.Action commit.Status = rebasingCommit.Status hydratedCommits = append(hydratedCommits, commit) |