diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-04-22 01:35:05 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-04-22 01:35:05 +0300 |
commit | b64894c2063e5875bfd95b537eafcb3e1abf46ff (patch) | |
tree | 989d1d734418b366f23738b228b96dcd6ec1acbd /t/t7004-tag.sh | |
parent | 9e0d1aa495bd26f4688b915ac5c3cb656c9f7174 (diff) | |
parent | aabfdc9514a51d8d9a2f3afbc29e5044ccf7191b (diff) |
Merge branch 'ow/ref-filter-omit-empty'
"git branch --format=..." and "git format-patch --format=..."
learns "--omit-empty" to hide refs that whose formatting result
becomes an empty string from the output.
* ow/ref-filter-omit-empty:
branch, for-each-ref, tag: add option to omit empty lines
Diffstat (limited to 't/t7004-tag.sh')
-rwxr-xr-x | t/t7004-tag.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 32b312fa80..0fe6ba93a2 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -2046,6 +2046,22 @@ test_expect_success '--format should list tags as per format given' ' test_cmp expect actual ' +test_expect_success '--format --omit-empty works' ' + cat >expect <<-\EOF && + refname : refs/tags/v1.0 + + refname : refs/tags/v1.1.3 + EOF + git tag -l --format="%(if:notequals=refs/tags/v1.0.1)%(refname)%(then)refname : %(refname)%(end)" "v1*" >actual && + test_cmp expect actual && + cat >expect <<-\EOF && + refname : refs/tags/v1.0 + refname : refs/tags/v1.1.3 + EOF + git tag -l --omit-empty --format="%(if:notequals=refs/tags/v1.0.1)%(refname)%(then)refname : %(refname)%(end)" "v1*" >actual && + test_cmp expect actual +' + test_expect_success 'git tag -l with --format="%(rest)" must fail' ' test_must_fail git tag -l --format="%(rest)" "v1*" ' |