From 8dd57a1ed221f592579dd925f22979047d289e78 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 7 Nov 2019 15:41:50 -0800 Subject: [PATCH] When fetching Git repositories, pass "--no-tags" to make explicit "Fetch Refs" operate more narrowly Summary: Ref T13448. The default behavior of "git fetch '+refs/heads/master:refs/heads/master'" is to follow and fetch associated tags. We don't want this when we pass a narrow refspec because of "Fetch Refs" configuration. Tell Git that we only want the refs we explicitly passed. Note that this doesn't prevent us from fetching tags (if the refspec specifies them), it just stops us from fetching extra tags that aren't part of the refspec. Test Plan: - Ran "bin/repository pull X --trace --verbose" in a repository with a "Fetch Refs" configuration, saw only "master" get fetched (previously: "master" and reachable tags). - Ran "git fetch --no-tags '+refs/*:refs/*'", saw tags fetched normally ("--no-tags" does not disable fetching tags). Maniphest Tasks: T13448 Differential Revision: https://secure.phabricator.com/D20893 --- .../repository/engine/PhabricatorRepositoryPullEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php index a7302341f4..c228932ac8 100644 --- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php @@ -421,7 +421,7 @@ final class PhabricatorRepositoryPullEngine // checked out. See T13280. $future = $repository->getRemoteCommandFuture( - 'fetch --update-head-ok -- %P %Ls', + 'fetch --no-tags --update-head-ok -- %P %Ls', $repository->getRemoteURIEnvelope(), $fetch_rules);