diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-04-21 15:35:05 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-04-21 15:35:05 -0700 |
| commit | b64894c2063e5875bfd95b537eafcb3e1abf46ff (patch) | |
| tree | 989d1d734418b366f23738b228b96dcd6ec1acbd /t/t3203-branch-output.sh | |
| parent | Merge branch 'ah/format-patch-thread-doc' (diff) | |
| parent | branch, for-each-ref, tag: add option to omit empty lines (diff) | |
| download | git-b64894c2063e5875bfd95b537eafcb3e1abf46ff.tar.gz git-b64894c2063e5875bfd95b537eafcb3e1abf46ff.zip | |
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/t3203-branch-output.sh')
| -rwxr-xr-x | t/t3203-branch-output.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index 1c0f7ea24e..93f8295339 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -355,6 +355,30 @@ test_expect_success 'git branch with --format=%(rest) must fail' ' test_must_fail git branch --format="%(rest)" >actual ' +test_expect_success 'git branch --format --omit-empty' ' + cat >expect <<-\EOF && + Refname is (HEAD detached from fromtag) + Refname is refs/heads/ambiguous + Refname is refs/heads/branch-one + Refname is refs/heads/branch-two + + Refname is refs/heads/ref-to-branch + Refname is refs/heads/ref-to-remote + EOF + git branch --format="%(if:notequals=refs/heads/main)%(refname)%(then)Refname is %(refname)%(end)" >actual && + test_cmp expect actual && + cat >expect <<-\EOF && + Refname is (HEAD detached from fromtag) + Refname is refs/heads/ambiguous + Refname is refs/heads/branch-one + Refname is refs/heads/branch-two + Refname is refs/heads/ref-to-branch + Refname is refs/heads/ref-to-remote + EOF + git branch --omit-empty --format="%(if:notequals=refs/heads/main)%(refname)%(then)Refname is %(refname)%(end)" >actual && + test_cmp expect actual +' + test_expect_success 'worktree colors correct' ' cat >expect <<-EOF && * <GREEN>(HEAD detached from fromtag)<RESET> |
