diff options
Diffstat (limited to 'cmd/gitaly-git2go/cherry_pick.go')
-rw-r--r-- | cmd/gitaly-git2go/cherry_pick.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cmd/gitaly-git2go/cherry_pick.go b/cmd/gitaly-git2go/cherry_pick.go index ebf29759f..1a185a7e2 100644 --- a/cmd/gitaly-git2go/cherry_pick.go +++ b/cmd/gitaly-git2go/cherry_pick.go @@ -102,21 +102,26 @@ func (cmd *cherryPickSubcommand) cherryPick(ctx context.Context, r *git2go.Cherr } } - tree, err := index.WriteTreeTo(repo) + treeOID, err := index.WriteTreeTo(repo) if err != nil { return "", fmt.Errorf("could not write tree: %w", err) } + tree, err := repo.LookupTree(treeOID) + if err != nil { + return "", fmt.Errorf("lookup tree: %w", err) + } - if tree.Equal(ours.TreeId()) { + if treeOID.Equal(ours.TreeId()) { return "", git2go.EmptyError{} } committer := git.Signature(git2go.NewSignature(r.CommitterName, r.CommitterMail, r.CommitterDate)) - commit, err := repo.CreateCommitFromIds("", pick.Author(), &committer, r.Message, tree, ours.Id()) + commitID, err := git2goutil.NewCommitSubmitter(repo, r.SigningKey). + Commit(pick.Author(), &committer, git.MessageEncodingUTF8, r.Message, tree, ours) if err != nil { - return "", fmt.Errorf("could not create cherry-pick commit: %w", err) + return "", fmt.Errorf("create not create cherry-pick commit: %w", err) } - return commit.String(), nil + return commitID.String(), nil } |