Skip to content

Commit 0f80d89

Browse files
committed
Merge branch 'dj/fetch-all-tags'
"git fetch --all", when passed "--no-tags", did not honor the "--no-tags" option while fetching from individual remotes (the same issue existed with "--tags", but combination "--all --tags" makes much less sense than "--all --no-tags"). * dj/fetch-all-tags: fetch --all: pass --tags/--no-tags through to each remote
2 parents e9496f8 + 8556646 commit 0f80d89

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

builtin/fetch.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,10 @@ static void add_options_to_argv(struct argv_array *argv)
858858
argv_array_push(argv, "--recurse-submodules");
859859
else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND)
860860
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");
861865
if (verbosity >= 2)
862866
argv_array_push(argv, "-v");
863867
if (verbosity >= 1)

t/t5514-fetch-multiple.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,34 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
151151
test_cmp ../expect output)
152152
'
153153

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+
154184
test_done

0 commit comments

Comments
 (0)