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 <ossi@kde.org> Signed-off-by: Dan Johnson <ComputerDruid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dan Johnson committed Sep 5, 2012 at 17:22 UTC 85566460897ee76555a7c90a951fe2d50272eb5e
2 files changed +34
builtin/fetch.c
+4
@@ -858,6 +858,10 @@ static void add_options_to_argv(struct argv_array *argv)
858 argv_array_push(argv, "--recurse-submodules");
859 else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND)
860 argv_array_push(argv, "--recurse-submodules=on-demand");
861 + if (tags == TAGS_SET)
862 + argv_array_push(argv, "--tags");
863 + else if (tags == TAGS_UNSET)
864 + argv_array_push(argv, "--no-tags");
865 if (verbosity >= 2)
866 argv_array_push(argv, "-v");
867 if (verbosity >= 1)
t/t5514-fetch-multiple.sh
+30
@@ -151,4 +151,34 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
151 test_cmp ../expect output)
152 '
153
154 +test_expect_success 'git fetch --all --no-tags' '
155 + >expect &&
156 + git clone one test5 &&
157 + git clone test5 test6 &&
158 + (cd test5 && git tag test-tag) &&
159 + (
160 + cd test6 &&
161 + git fetch --all --no-tags &&
162 + git tag >output
163 + ) &&
164 + test_cmp expect test6/output
165 +'
166 +
167 +test_expect_success 'git fetch --all --tags' '
168 + echo test-tag >expect &&
169 + git clone one test7 &&
170 + git clone test7 test8 &&
171 + (
172 + cd test7 &&
173 + test_commit test-tag &&
174 + git reset --hard HEAD^
175 + ) &&
176 + (
177 + cd test8 &&
178 + git fetch --all --tags &&
179 + git tag >output
180 + ) &&
181 + test_cmp expect test8/output
182 +'
183 +
184 test_done