3 test_description
='git branch display tests'
6 test_expect_success
'make commits' '
10 echo content >>file &&
14 test_expect_success
'make branches' '
15 git branch branch-one &&
16 git branch branch-two HEAD^
19 test_expect_success
'make remote branches' '
20 git update-ref refs/remotes/origin/branch-one branch-one &&
21 git update-ref refs/remotes/origin/branch-two branch-two &&
22 git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/branch-one
30 test_expect_success
'git branch shows local branches' '
32 test_cmp expect actual
35 test_expect_success
'git branch --list shows local branches' '
36 git branch --list >actual &&
37 test_cmp expect actual
44 test_expect_success
'git branch --list pattern shows matching local branches' '
45 git branch --list branch* >actual &&
46 test_cmp expect actual
50 origin/HEAD -> origin/branch-one
54 test_expect_success
'git branch -r shows remote branches' '
55 git branch -r >actual &&
56 test_cmp expect actual
63 remotes/origin/HEAD -> origin/branch-one
64 remotes/origin/branch-one
65 remotes/origin/branch-two
67 test_expect_success
'git branch -a shows local and remote branches' '
68 git branch -a >actual &&
69 test_cmp expect actual
77 test_expect_success
'git branch -v shows branch summaries' '
79 awk "{print \$NF}" <tmp >actual &&
80 test_cmp expect actual
87 test_expect_success
'git branch --list -v pattern shows branch summaries' '
88 git branch --list -v branch* >tmp &&
89 awk "{print \$NF}" <tmp >actual &&
90 test_cmp expect actual
93 test_expect_success
'git branch -v pattern does not show branch summaries' '
94 test_must_fail git branch -v branch*
103 test_expect_success
'git branch shows detached HEAD properly' '
104 git checkout HEAD^0 &&
105 git branch >actual &&
106 test_i18ncmp expect actual