Skip to content

Commit 20d04b4

Browse files
committed
Merge branch 'ag/rev-parse-all-exclude-fix'
"git rev-parse --exclude=* --branches --branches" (i.e. first saying "add only things that do not match '*' out of all branches" and then adding all branches, without any exclusion this time") worked as expected, but "--exclude=* --all --all" did not work the same way, which has been fixed. * ag/rev-parse-all-exclude-fix: rev-parse: clear --exclude list after 'git rev-parse --all'
2 parents 67cf2fa + 5221048 commit 20d04b4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

builtin/rev-parse.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
765765
}
766766
if (!strcmp(arg, "--all")) {
767767
for_each_ref(show_reference, NULL);
768+
clear_ref_exclusion(&ref_excludes);
768769
continue;
769770
}
770771
if (skip_prefix(arg, "--disambiguate=", &arg)) {

t/t6018-rev-list-glob.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@ test_expect_success 'rev-parse accumulates multiple --exclude' '
141141
compare rev-parse "--exclude=refs/remotes/* --exclude=refs/tags/* --all" --branches
142142
'
143143

144+
test_expect_success 'rev-parse --branches clears --exclude' '
145+
compare rev-parse "--exclude=* --branches --branches" "--branches"
146+
'
147+
148+
test_expect_success 'rev-parse --tags clears --exclude' '
149+
compare rev-parse "--exclude=* --tags --tags" "--tags"
150+
'
151+
152+
test_expect_success 'rev-parse --all clears --exclude' '
153+
compare rev-parse "--exclude=* --all --all" "--all"
154+
'
155+
144156
test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
145157
146158
compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/*"

0 commit comments

Comments
 (0)