Skip to content

Commit

Permalink
Fix ambiguous argument error on tags (go-gitea#15432)
Browse files Browse the repository at this point in the history
Backport go-gitea#15432

There is a weird gotcha with GetTagCommitID that because it uses git rev-list
can cause an ambiguous argument error.

This PR simply makes tags use the same code as branches.

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Apr 14, 2021
1 parent bec6051 commit 50c3264
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions modules/git/repo_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@ func (repo *Repository) GetBranchCommitID(name string) (string, error) {

// GetTagCommitID returns last commit ID string of given tag.
func (repo *Repository) GetTagCommitID(name string) (string, error) {
stdout, err := NewCommand("rev-list", "-n", "1", TagPrefix+name).RunInDir(repo.Path)
if err != nil {
if strings.Contains(err.Error(), "unknown revision or path") {
return "", ErrNotExist{name, ""}
}
return "", err
}
return strings.TrimSpace(stdout), nil
return repo.GetRefCommitID(TagPrefix + name)
}

func convertPGPSignatureForTag(t *object.Tag) *CommitGPGSignature {
Expand Down

0 comments on commit 50c3264

Please sign in to comment.