Merge branch 'jk/describe-omit-some-refs' into mk/describe-match-with-all

* jk/describe-omit-some-refs:
  describe: fix matching to actually match all patterns
This commit is contained in:
Junio C Hamano 2017-09-20 13:30:01 +09:00
commit 3445c3dd72
2 changed files with 12 additions and 5 deletions

View File

@ -158,20 +158,23 @@ 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. */
return 0;
}
}
if (!found)
return 0;
}
/* Is it annotated? */
if (!peel_ref(path, peeled.hash)) {
is_annotated = !!oidcmp(oid, &peeled);

View File

@ -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) &&