diff options
author | zeripath | 2021-04-14 19:52:55 +0100 |
---|---|---|
committer | GitHub | 2021-04-14 19:52:55 +0100 |
commit | 05f266c3315aec95f4cf18a9938decd707603e53 (patch) | |
tree | b7cd80a6ca9e41da29daf14e5ea929224eb6c660 | |
parent | bec60518e9cadb485030850e7a38881c7a17a9a9 (diff) |
Fix ambiguous argument error on tags (#15432) (#15475)
Backport #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 <art27@cantab.net>
-rw-r--r-- | modules/git/repo_commit.go | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 70fe6fbcd..ebecfd103 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -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 { |