diff options
author | Aaron Lipman <alipman88@gmail.com> | 2020-09-16 04:08:40 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-16 21:38:10 +0200 |
commit | 21bf933928c02372633b88aa6c4d9d71271d42b3 (patch) | |
tree | e2ad37586b8eef4cb8bee34ff495ed4d7aed0c46 /t/t3201-branch-contains.sh | |
parent | Doc: cover multiple contains/no-contains filters (diff) | |
download | git-21bf933928c02372633b88aa6c4d9d71271d42b3.tar.xz git-21bf933928c02372633b88aa6c4d9d71271d42b3.zip |
ref-filter: allow merged and no-merged filters
Enable ref-filter to process multiple merged and no-merged filters, and
extend functionality to git branch, git tag and git for-each-ref. This
provides an easy way to check for branches that are "graduation
candidates:"
$ git branch --no-merged master --merged next
If passed more than one merged (or more than one no-merged) filter, refs
must be reachable from any one of the merged commits, and reachable from
none of the no-merged commits.
Signed-off-by: Aaron Lipman <alipman88@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3201-branch-contains.sh')
-rwxr-xr-x | t/t3201-branch-contains.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh index 3cb9dc6cca..efea5c4971 100755 --- a/t/t3201-branch-contains.sh +++ b/t/t3201-branch-contains.sh @@ -187,6 +187,16 @@ test_expect_success 'multiple branch --contains' ' test_cmp expect actual ' +test_expect_success 'multiple branch --merged' ' + git branch --merged next --merged master >actual && + cat >expect <<-\EOF && + master + * next + side + EOF + test_cmp expect actual +' + test_expect_success 'multiple branch --no-contains' ' git branch --no-contains side --no-contains side2 >actual && cat >expect <<-\EOF && @@ -195,6 +205,14 @@ test_expect_success 'multiple branch --no-contains' ' test_cmp expect actual ' +test_expect_success 'multiple branch --no-merged' ' + git branch --no-merged next --no-merged master >actual && + cat >expect <<-\EOF && + side2 + EOF + test_cmp expect actual +' + test_expect_success 'branch --contains combined with --no-contains' ' git checkout -b seen master && git merge side && @@ -207,6 +225,15 @@ test_expect_success 'branch --contains combined with --no-contains' ' test_cmp expect actual ' +test_expect_success 'branch --merged combined with --no-merged' ' + git branch --merged seen --no-merged next >actual && + cat >expect <<-\EOF && + * seen + side2 + EOF + test_cmp expect actual +' + # We want to set up a case where the walk for the tracking info # of one branch crosses the tip of another branch (and make sure # that the latter walk does not mess up our flag to see if it was |