summaryrefslogtreecommitdiff
path: root/builtin/describe.c
diff options
context:
space:
mode:
authorMax Kirillov <max@max630.net>2017-09-16 05:53:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-17 01:21:12 (GMT)
commitda769d2986470931b8e80b8d14afcae3d7cc20d7 (patch)
treedcf2d3d34e7067b2b3f1774abdfe4355efd16f50 /builtin/describe.c
parent77d21f29eaddb1fbe82e013ea42d4e0180bbdda2 (diff)
downloadgit-da769d2986470931b8e80b8d14afcae3d7cc20d7.zip
git-da769d2986470931b8e80b8d14afcae3d7cc20d7.tar.gz
git-da769d2986470931b8e80b8d14afcae3d7cc20d7.tar.bz2
describe: fix matching to actually match all patterns
`git describe --match` with multiple patterns matches only first pattern. If it fails, next patterns are not tried. Fix it, add test cases and update existing test which has wrong expectation. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/describe.c')
-rw-r--r--builtin/describe.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index 6769446..ba4ebb4 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -151,18 +151,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, NULL))
+ if (!wildmatch(item->string, path + 10, 0, NULL)) {
+ found = 1;
break;
+ }
+ }
- /* If we get here, no pattern matched. */
+ if (!found)
return 0;
- }
}
/* Is it annotated? */