summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-04-14 15:22:37 +0100
committerGitHub <noreply@github.com>2021-04-14 16:22:37 +0200
commit1ee776970ac102121871b184b965c30103a2da71 (patch)
treefc23e80cff0ef7ccb2c859c90d52ef446e1f7945 /modules
parent424bd86c607048a4cdf618614a24cc3aeb2d0ac8 (diff)
downloadgitea-1ee776970ac102121871b184b965c30103a2da71.tar.gz
gitea-1ee776970ac102121871b184b965c30103a2da71.zip
Fix ambiguous argument error on tags (#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>
Diffstat (limited to 'modules')
-rw-r--r--modules/git/repo_commit.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index ea0aeeb35d..5e2db34fd1 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -21,14 +21,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)
}
// ConvertToSHA1 returns a Hash object from a potential ID string