1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00

Fix interactive rebase with git 2.25.1 and earlier (#2747)

This commit is contained in:
Stefan Haller 2023-07-10 13:48:37 +02:00 committed by GitHub
commit f9414f275d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)