Merge branch 'jk/describe-omit-some-refs' into mk/describe-match-with-all
authorJunio C Hamano <gitster@pobox.com>
Wed, 20 Sep 2017 04:30:01 +0000 (13:30 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Sep 2017 04:30:01 +0000 (13:30 +0900)
* jk/describe-omit-some-refs:
describe: fix matching to actually match all patterns

builtin/describe.c
t/t6120-describe.sh
index e77163e909d07ec168d41d8b96e05afa73490848..3dc18364809c3c5f88b9f31d7877a58caad87755 100644 (file)
@@ -158,18 +158,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? */
index aa74eb8f0d5dfb4f228b1e8c7b9dbbc0b88adb4d..25110ea55d89656ab3fd4da525d4c94bc75840ac 100755 (executable)
@@ -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) &&