Merge branch 'ag/rev-parse-all-exclude-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Nov 2018 13:37:23 +0000 (22:37 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Nov 2018 13:37:23 +0000 (22:37 +0900)
"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'

builtin/rev-parse.c
t/t6018-rev-list-glob.sh
index 455f62246d69ad0468ffde58e568732bd3339c63..10d4dab894e25a73d6a761205ce53c88019a4a8b 100644 (file)
@@ -765,6 +765,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                        }
                        if (!strcmp(arg, "--all")) {
                                for_each_ref(show_reference, NULL);
+                               clear_ref_exclusion(&ref_excludes);
                                continue;
                        }
                        if (skip_prefix(arg, "--disambiguate=", &arg)) {
index db8a7834d88e6d01b3cc5106af749ede7b75866a..270e579c2d3a30b2a08517bc63fe6edf5221af59 100755 (executable)
@@ -141,6 +141,18 @@ test_expect_success 'rev-parse accumulates multiple --exclude' '
        compare rev-parse "--exclude=refs/remotes/* --exclude=refs/tags/* --all" --branches
 '
 
+test_expect_success 'rev-parse --branches clears --exclude' '
+       compare rev-parse "--exclude=* --branches --branches" "--branches"
+'
+
+test_expect_success 'rev-parse --tags clears --exclude' '
+       compare rev-parse "--exclude=* --tags --tags" "--tags"
+'
+
+test_expect_success 'rev-parse --all clears --exclude' '
+       compare rev-parse "--exclude=* --all --all" "--all"
+'
+
 test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
 
        compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/*"