Skip to content

Commit 3445c3d

Browse files
committed
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
2 parents 9ddaf86 + da769d2 commit 3445c3d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

builtin/describe.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,21 @@ static int get_name(const char *path, const struct object_id *oid, int flag, voi
158158
* pattern.
159159
*/
160160
if (patterns.nr) {
161+
int found = 0;
161162
struct string_list_item *item;
162163

163164
if (!is_tag)
164165
return 0;
165166

166167
for_each_string_list_item(item, &patterns) {
167-
if (!wildmatch(item->string, path + 10, 0))
168+
if (!wildmatch(item->string, path + 10, 0)) {
169+
found = 1;
168170
break;
171+
}
172+
}
169173

170-
/* If we get here, no pattern matched. */
174+
if (!found)
171175
return 0;
172-
}
173176
}
174177

175178
/* Is it annotated? */

t/t6120-describe.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,14 @@ check_describe "test2-lightweight-*" --tags --match="test2-*"
182182

183183
check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^
184184

185-
check_describe "test1-lightweight-*" --long --tags --match="test1-*" --match="test2-*" HEAD^
185+
check_describe "test2-lightweight-*" --long --tags --match="test1-*" --match="test2-*" HEAD^
186186

187187
check_describe "test2-lightweight-*" --long --tags --match="test1-*" --no-match --match="test2-*" HEAD^
188188

189+
check_describe "test1-lightweight-*" --long --tags --match="test1-*" --match="test3-*" HEAD
190+
191+
check_describe "test1-lightweight-*" --long --tags --match="test3-*" --match="test1-*" HEAD
192+
189193
test_expect_success 'name-rev with exact tags' '
190194
echo A >expect &&
191195
tag_object=$(git rev-parse refs/tags/A) &&

0 commit comments

Comments
 (0)