Skip to content

Commit aa2e473

Browse files
authored
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 <[email protected]> * Update modules/git/repo_compare.go * Update modules/git/repo_compare.go Signed-off-by: Andrew Thornton <[email protected]>
1 parent 3d870f6 commit aa2e473

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/git/repo_compare.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (repo *Repository) GetMergeBase(tmpRemote, base, head string) (string, stri
4040
if tmpRemote != "origin" {
4141
tmpBaseName := RemotePrefix + tmpRemote + "/tmp_" + base
4242
// Fetch commit into a temporary branch in order to be able to handle commits and tags
43-
_, _, err := NewCommand(repo.Ctx, "fetch", tmpRemote, base+":"+tmpBaseName).RunStdString(&RunOpts{Dir: repo.Path})
43+
_, _, err := NewCommand(repo.Ctx, "fetch", "--no-tags", tmpRemote, "--", base+":"+tmpBaseName).RunStdString(&RunOpts{Dir: repo.Path})
4444
if err == nil {
4545
base = tmpBaseName
4646
}

0 commit comments

Comments
 (0)