Skip to content

Commit a7fac8c

Browse files
committed
pkg/git: Include commit message and URL in error
go-git: Include the commit message in the returned commit object. libgit2: Set the URL in the checkout error. Signed-off-by: Sunny <darkowlzz@protonmail.com>
1 parent af0226b commit a7fac8c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pkg/git/gogit/checkout.go

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ func buildCommitWithRef(c *object.Commit, ref plumbing.ReferenceName) (*git.Comm
315315
Committer: buildSignature(c.Committer),
316316
Signature: c.PGPSignature,
317317
Encoded: b,
318+
Message: c.Message,
318319
}, nil
319320
}
320321

pkg/git/libgit2/checkout.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (c *CheckoutBranch) Checkout(ctx context.Context, path, url string, opts *g
6969
CheckoutBranch: c.Branch,
7070
})
7171
if err != nil {
72-
return nil, fmt.Errorf("unable to clone: %w", gitutil.LibGit2Error(err))
72+
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.LibGit2Error(err))
7373
}
7474
defer repo.Free()
7575
head, err := repo.Head()

0 commit comments

Comments
 (0)