describe: teach describe negative pattern matches
Teach git-describe the `--exclude` option which will allow specifying a glob pattern of tags to ignore. This can be combined with the `--match` patterns to enable more flexibility in determining which tags to consider. For example, suppose you wish to find the first official release tag that contains a certain commit. If we assume that official release tags are of the form "v*" and pre-release candidates include "*rc*" in their name, we can now find the first release tag that introduces the commit abcdef: git describe --contains --match="v*" --exclude="*rc*" abcdef Add documentation, tests, and completion for this change. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
43f8080eaf
commit
77d21f29ea
@@ -218,6 +218,14 @@ test_expect_success 'describe --contains and --match' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'describe --exclude' '
|
||||
echo "c~1" >expect &&
|
||||
tagged_commit=$(git rev-parse "refs/tags/A^0") &&
|
||||
test_must_fail git describe --contains --match="B" $tagged_commit &&
|
||||
git describe --contains --match="?" --exclude="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") &&
|
||||
|
||||
Reference in New Issue
Block a user