diff options
author | Karthik Nayak <karthik.188@gmail.com> | 2017-01-10 14:19:53 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-31 12:43:04 -0800 |
commit | 3d9e4ce3ebef4f5aa47dad49f730e085f32b98da (patch) | |
tree | cada5fd03251f448fedd1754a54945bc0011ef6f /t/t3203-branch-output.sh | |
parent | 949af0684c1f84587504e2143fca6f9bb8504e31 (diff) | |
download | git-3d9e4ce3ebef4f5aa47dad49f730e085f32b98da.tar.gz |
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-x | t/t3203-branch-output.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index 45213280a1..5778c0afe1 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 |