aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-08-23 19:12:43 +0100
committerGitHub <noreply@github.com>2022-08-23 14:12:43 -0400
commitaa2e47399158ea5958638f5bb5f89967054bf48e (patch)
tree5d5a24300481765a4318d47e703395a7ad2a4bde /modules
parent3d870f6dde9fa688a04d20150d224c4eb8c3f961 (diff)
downloadgitea-aa2e47399158ea5958638f5bb5f89967054bf48e.tar.gz
gitea-aa2e47399158ea5958638f5bb5f89967054bf48e.zip
Set no-tags in git fetch on compare (#20893)
* Set no-tags in git fetch on compare In the compare endpoint the git fetch is restricted to a certain branch however, this does not completely prevent tag acquisition/pollution as git fetch will collect any tags on that branch. This causes pollution of the tag namespace and could cause confusion by users. This PR adds `--no-tags` to the `git fetch` call. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update modules/git/repo_compare.go * Update modules/git/repo_compare.go Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/git/repo_compare.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/git/repo_compare.go b/modules/git/repo_compare.go
index 577c9f475e..589a7eae00 100644
--- a/modules/git/repo_compare.go
+++ b/modules/git/repo_compare.go
@@ -40,7 +40,7 @@ func (repo *Repository) GetMergeBase(tmpRemote, base, head string) (string, stri
if tmpRemote != "origin" {
tmpBaseName := RemotePrefix + tmpRemote + "/tmp_" + base
// Fetch commit into a temporary branch in order to be able to handle commits and tags
- _, _, err := NewCommand(repo.Ctx, "fetch", tmpRemote, base+":"+tmpBaseName).RunStdString(&RunOpts{Dir: repo.Path})
+ _, _, err := NewCommand(repo.Ctx, "fetch", "--no-tags", tmpRemote, "--", base+":"+tmpBaseName).RunStdString(&RunOpts{Dir: repo.Path})
if err == nil {
base = tmpBaseName
}