summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-10-18 14:19:01 +0900
committerJunio C Hamano <gitster@pobox.com>2017-10-18 14:19:01 +0900
commit501ec0dad31a5379ac7620f8655de882844fd3c1 (patch)
treef70bdfbae0b2f99e4aa1b278bd22b72609c3487c
parent8dc1d0bf64ce84030a1a13ea64343f816dba9e27 (diff)
parentda769d2986470931b8e80b8d14afcae3d7cc20d7 (diff)
downloadgit-501ec0dad31a5379ac7620f8655de882844fd3c1.tar.gz
Merge branch 'jk/describe-omit-some-refs' into maint
"git describe --match" learned to take multiple patterns in v2.13 series, but the feature ignored the patterns after the first one and did not work at all. This has been fixed. * jk/describe-omit-some-refs: describe: fix matching to actually match all patterns
-rw-r--r--builtin/describe.c9
-rwxr-xr-xt/t6120-describe.sh6
2 files changed, 11 insertions, 4 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index 89ea1cdd60..94ff2fba0b 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -155,18 +155,21 @@ static int get_name(const char *path, const struct object_id *oid, int flag, voi
* pattern.
*/
if (patterns.nr) {
+ int found = 0;
struct string_list_item *item;
if (!is_tag)
return 0;
for_each_string_list_item(item, &patterns) {
- if (!wildmatch(item->string, path + 10, 0))
+ if (!wildmatch(item->string, path + 10, 0)) {
+ found = 1;
break;
+ }
+ }
- /* If we get here, no pattern matched. */
+ if (!found)
return 0;
- }
}
/* Is it annotated? */
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index aa74eb8f0d..25110ea55d 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -182,10 +182,14 @@ check_describe "test2-lightweight-*" --tags --match="test2-*"
check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^
-check_describe "test1-lightweight-*" --long --tags --match="test1-*" --match="test2-*" HEAD^
+check_describe "test2-lightweight-*" --long --tags --match="test1-*" --match="test2-*" HEAD^
check_describe "test2-lightweight-*" --long --tags --match="test1-*" --no-match --match="test2-*" HEAD^
+check_describe "test1-lightweight-*" --long --tags --match="test1-*" --match="test3-*" HEAD
+
+check_describe "test1-lightweight-*" --long --tags --match="test3-*" --match="test1-*" HEAD
+
test_expect_success 'name-rev with exact tags' '
echo A >expect &&
tag_object=$(git rev-parse refs/tags/A) &&