diff options
author | Jacob Keller <jacob.keller@gmail.com> | 2017-01-18 15:06:08 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-23 18:33:17 -0800 |
commit | 77d21f29eaddb1fbe82e013ea42d4e0180bbdda2 (patch) | |
tree | 589f2e6d1fc2efdddc2c00c7d6f21babb9eba369 /t/t6120-describe.sh | |
parent | 43f8080eaff82e7aedaec5aa3abfd115cf1af695 (diff) | |
download | git-77d21f29eaddb1fbe82e013ea42d4e0180bbdda2.tar.gz |
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>
Diffstat (limited to 't/t6120-describe.sh')
-rwxr-xr-x | t/t6120-describe.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 9e5db9b87a..167491fd5b 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -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") && |