Skip to content

Commit 5221048

Browse files
Andreas Gruenbachergitster
authored andcommitted
rev-parse: clear --exclude list after 'git rev-parse --all'
Commit [1] added the --exclude option to revision.c. The --all, --branches, --tags, --remotes, and --glob options clear the exclude list. Shortly therafter, commit [2] added the same to 'git rev-parse', but without clearing the exclude list for the --all option. [1] e7b432c ("revision: introduce --exclude=<glob> to tame wildcards", 2013-08-30) [2] 9dc01bf ("rev-parse: introduce --exclude=<glob> to tame wildcards", 2013-11-01) Signed-off-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6e9e91e commit 5221048

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
@@ -760,6 +760,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
760760
}
761761
if (!strcmp(arg, "--all")) {
762762
for_each_ref(show_reference, NULL);
763+
clear_ref_exclusion(&ref_excludes);
763764
continue;
764765
}
765766
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)