Browse Source

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
maint
Junio C Hamano 7 years ago
parent
commit
501ec0dad3
  1. 9
      builtin/describe.c
  2. 6
      t/t6120-describe.sh

9
builtin/describe.c

@ -155,18 +155,21 @@ static int get_name(const char *path, const struct object_id *oid, int flag, voi
* pattern. * pattern.
*/ */
if (patterns.nr) { if (patterns.nr) {
int found = 0;
struct string_list_item *item; struct string_list_item *item;


if (!is_tag) if (!is_tag)
return 0; return 0;


for_each_string_list_item(item, &patterns) { for_each_string_list_item(item, &patterns) {
if (!wildmatch(item->string, path + 10, 0)) if (!wildmatch(item->string, path + 10, 0)) {
found = 1;
break; break;
}
}


/* If we get here, no pattern matched. */ if (!found)
return 0; return 0;
}
} }


/* Is it annotated? */ /* Is it annotated? */

6
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 "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 "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' ' test_expect_success 'name-rev with exact tags' '
echo A >expect && echo A >expect &&
tag_object=$(git rev-parse refs/tags/A) && tag_object=$(git rev-parse refs/tags/A) &&

Loading…
Cancel
Save