summaryrefslogtreecommitdiff
path: root/t/t3203-branch-output.sh
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2017-01-10 08:49:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-31 20:43:04 (GMT)
commit3d9e4ce3ebef4f5aa47dad49f730e085f32b98da (patch)
treecada5fd03251f448fedd1754a54945bc0011ef6f /t/t3203-branch-output.sh
parent949af0684c1f84587504e2143fca6f9bb8504e31 (diff)
downloadgit-3d9e4ce3ebef4f5aa47dad49f730e085f32b98da.zip
git-3d9e4ce3ebef4f5aa47dad49f730e085f32b98da.tar.gz
git-3d9e4ce3ebef4f5aa47dad49f730e085f32b98da.tar.bz2
branch: implement '--format' option
Implement the '--format' option provided by 'ref-filter'. This lets the user list branches as per desired format similar to the implementation in 'git for-each-ref'. Add tests and documentation for the same. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3203-branch-output.sh')
-rwxr-xr-xt/t3203-branch-output.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index 4521328..5778c0a 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -225,4 +225,18 @@ test_expect_success 'sort branches, ignore case' '
)
'
+test_expect_success 'git branch --format option' '
+ 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/master
+ Refname is refs/heads/ref-to-branch
+ Refname is refs/heads/ref-to-remote
+ EOF
+ git branch --format="Refname is %(refname)" >actual &&
+ test_cmp expect actual
+'
+
test_done