summaryrefslogtreecommitdiff
path: root/t/t6300-for-each-ref.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-04-21 15:35:05 -0700
committerJunio C Hamano <gitster@pobox.com>2023-04-21 15:35:05 -0700
commitb64894c2063e5875bfd95b537eafcb3e1abf46ff (patch)
tree989d1d734418b366f23738b228b96dcd6ec1acbd /t/t6300-for-each-ref.sh
parent9e0d1aa495bd26f4688b915ac5c3cb656c9f7174 (diff)
parentaabfdc9514a51d8d9a2f3afbc29e5044ccf7191b (diff)
downloadgit-b64894c2063e5875bfd95b537eafcb3e1abf46ff.tar.gz
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/t6300-for-each-ref.sh')
-rwxr-xr-xt/t6300-for-each-ref.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 6614469d2d..5c00607608 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -1374,6 +1374,14 @@ test_expect_success 'for-each-ref --ignore-case ignores case' '
test_cmp expect actual
'
+test_expect_success 'for-each-ref --omit-empty works' '
+ git for-each-ref --format="%(refname)" >actual &&
+ test_line_count -gt 1 actual &&
+ git for-each-ref --format="%(if:equals=refs/heads/main)%(refname)%(then)%(refname)%(end)" --omit-empty >actual &&
+ echo refs/heads/main >expect &&
+ test_cmp expect actual
+'
+
test_expect_success 'for-each-ref --ignore-case works on multiple sort keys' '
# name refs numerically to avoid case-insensitive filesystem conflicts
nr=0 &&