From: Dan Johnson Date: Wed, 5 Sep 2012 21:22:19 +0000 (-0400) Subject: fetch --all: pass --tags/--no-tags through to each remote X-Git-Tag: v1.7.12.2~7^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=85566460897ee76555a7c90a951fe2d50272eb5e;p=git.git fetch --all: pass --tags/--no-tags through to each remote When fetch is invoked with --all, we need to pass the tag-following preference to each individual fetch; without this, we will always auto-follow tags, preventing us from fetching the remote tags into a remote-specific namespace, for example. Reported-by: Oswald Buddenhagen Signed-off-by: Dan Johnson Signed-off-by: Junio C Hamano --- diff --git a/builtin/fetch.c b/builtin/fetch.c index 6196e9179..4494aed0c 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -858,6 +858,10 @@ static void add_options_to_argv(struct argv_array *argv) argv_array_push(argv, "--recurse-submodules"); else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) argv_array_push(argv, "--recurse-submodules=on-demand"); + if (tags == TAGS_SET) + argv_array_push(argv, "--tags"); + else if (tags == TAGS_UNSET) + argv_array_push(argv, "--no-tags"); if (verbosity >= 2) argv_array_push(argv, "-v"); if (verbosity >= 1) diff --git a/t/t5514-fetch-multiple.sh b/t/t5514-fetch-multiple.sh index 227dd5613..0f8140957 100755 --- a/t/t5514-fetch-multiple.sh +++ b/t/t5514-fetch-multiple.sh @@ -151,4 +151,34 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' ' test_cmp ../expect output) ' +test_expect_success 'git fetch --all --no-tags' ' + >expect && + git clone one test5 && + git clone test5 test6 && + (cd test5 && git tag test-tag) && + ( + cd test6 && + git fetch --all --no-tags && + git tag >output + ) && + test_cmp expect test6/output +' + +test_expect_success 'git fetch --all --tags' ' + echo test-tag >expect && + git clone one test7 && + git clone test7 test8 && + ( + cd test7 && + test_commit test-tag && + git reset --hard HEAD^ + ) && + ( + cd test8 && + git fetch --all --tags && + git tag >output + ) && + test_cmp expect test8/output +' + test_done