diff options
author | Jacob Keller <jacob.keller@gmail.com> | 2017-01-18 15:06:06 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-23 18:33:17 -0800 |
commit | 96415b49dc4e10b64c014516a3f7cd9a51ed5269 (patch) | |
tree | 176b007e96a7cc390e217e2c8a1950ae2c7b6eef /t/t6007-rev-list-cherry-pick-file.sh | |
parent | 290be6674a4c89594105faa19061523e7380d586 (diff) | |
download | git-96415b49dc4e10b64c014516a3f7cd9a51ed5269.tar.gz |
name-rev: add support to exclude refs by pattern match
Extend git-name-rev to support excluding refs which match shell patterns
using --exclude. These patterns can be used to limit the scope of refs
by excluding any ref that matches one of the --exclude patterns. A ref
will only be used for naming when it matches at least one --refs pattern
but does not match any of the --exclude patterns. Thus, --exclude
patterns are given precedence over --refs patterns.
For example, suppose you wish to name a series of commits based on an
official release tag of the form "v*" but excluding any pre-release tags
which match "*rc*". You can use the following to do so:
git name-rev --refs="v*" --exclude="*rc*" --all
Add tests and update Documentation 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/t6007-rev-list-cherry-pick-file.sh')
-rwxr-xr-x | t/t6007-rev-list-cherry-pick-file.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh index d9827a6389..2959745196 100755 --- a/t/t6007-rev-list-cherry-pick-file.sh +++ b/t/t6007-rev-list-cherry-pick-file.sh @@ -118,6 +118,18 @@ test_expect_success 'name-rev --refs excludes non-matched patterns' ' test_cmp actual.named expect ' +cat >expect <<EOF +<tags/F +EOF + +test_expect_success 'name-rev --exclude excludes matched patterns' ' + git rev-list --left-right --right-only --cherry-pick F...E -- bar >>expect && + git rev-list --left-right --cherry-pick F...E -- bar >actual && + git name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \ + <actual >actual.named && + test_cmp actual.named expect +' + test_expect_success 'name-rev --no-refs clears the refs list' ' git rev-list --left-right --cherry-pick F...E -- bar >expect && git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" --no-refs --refs="*tags/G" \ |