path: root/t/
diff options
authorJacob Keller <>2017-01-18 23:06:07 (GMT)
committerJunio C Hamano <>2017-01-24 02:33:17 (GMT)
commit43f8080eaff82e7aedaec5aa3abfd115cf1af695 (patch)
treeffd0fcd51706bc5299d6a34505737bece08a808d /t/
parent96415b49dc4e10b64c014516a3f7cd9a51ed5269 (diff)
describe: teach --match to accept multiple patterns
Teach `--match` to be accepted multiple times, accumulating a list of patterns to match into a string list. Each pattern is inclusive, such that a tag need only match one of the provided patterns to be considered for matching. This extension is useful as it enables more flexibility in what tags match, and may avoid the need to run the describe command multiple times to get the same result. Add tests and update the documentation for this change. Signed-off-by: Jacob Keller <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 19 insertions, 0 deletions
diff --git a/t/ b/t/
index 85f2694..9e5db9b 100755
--- a/t/
+++ b/t/
@@ -182,6 +182,10 @@ 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-*" --no-match --match="test2-*" HEAD^
test_expect_success 'name-rev with exact tags' '
echo A >expect &&
tag_object=$(git rev-parse refs/tags/A) &&
@@ -206,4 +210,19 @@ test_expect_success 'describe --contains with the exact tags' '
test_cmp expect actual
+test_expect_success 'describe --contains and --match' '
+ echo "A^0" >expect &&
+ tagged_commit=$(git rev-parse "refs/tags/A^0") &&
+ test_must_fail git describe --contains --match="B" $tagged_commit &&
+ git describe --contains --match="B" --match="A" $tagged_commit >actual &&
+ test_cmp expect actual
+test_expect_success 'describe --contains and --no-match' '
+ echo "A^0" >expect &&
+ tagged_commit=$(git rev-parse "refs/tags/A^0") &&
+ git describe --contains --match="B" --no-match $tagged_commit >actual &&
+ test_cmp expect actual