Skip to content

Commit

Permalink
pkg/git: Include commit message and URL in error
Browse files Browse the repository at this point in the history
go-git: Include the commit message in the returned commit object.
libgit2: Set the URL in the checkout error.

Signed-off-by: Sunny <[email protected]>
  • Loading branch information
darkowlzz committed Feb 14, 2022
1 parent af0226b commit a7fac8c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/git/gogit/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ func buildCommitWithRef(c *object.Commit, ref plumbing.ReferenceName) (*git.Comm
Committer: buildSignature(c.Committer),
Signature: c.PGPSignature,
Encoded: b,
Message: c.Message,
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/git/libgit2/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *CheckoutBranch) Checkout(ctx context.Context, path, url string, opts *g
CheckoutBranch: c.Branch,
})
if err != nil {
return nil, fmt.Errorf("unable to clone: %w", gitutil.LibGit2Error(err))
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.LibGit2Error(err))
}
defer repo.Free()
head, err := repo.Head()
Expand Down

0 comments on commit a7fac8c

Please sign in to comment.