branch: introduce --list option
[git/raj.git] / t / t3203-branch-output.sh
blob97d10b1884d39cdef6efc9a0ce7384d7538ea366
1 #!/bin/sh
3 test_description='git branch display tests'
4 . ./test-lib.sh
6 test_expect_success 'make commits' '
7 echo content >file &&
8 git add file &&
9 git commit -m one &&
10 echo content >>file &&
11 git commit -a -m two
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
25 cat >expect <<'EOF'
26 branch-one
27 branch-two
28 * master
29 EOF
30 test_expect_success 'git branch shows local branches' '
31 git branch >actual &&
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
40 cat >expect <<'EOF'
41 origin/HEAD -> origin/branch-one
42 origin/branch-one
43 origin/branch-two
44 EOF
45 test_expect_success 'git branch -r shows remote branches' '
46 git branch -r >actual &&
47 test_cmp expect actual
50 cat >expect <<'EOF'
51 branch-one
52 branch-two
53 * master
54 remotes/origin/HEAD -> origin/branch-one
55 remotes/origin/branch-one
56 remotes/origin/branch-two
57 EOF
58 test_expect_success 'git branch -a shows local and remote branches' '
59 git branch -a >actual &&
60 test_cmp expect actual
63 cat >expect <<'EOF'
64 two
65 one
66 two
67 EOF
68 test_expect_success 'git branch -v shows branch summaries' '
69 git branch -v >tmp &&
70 awk "{print \$NF}" <tmp >actual &&
71 test_cmp expect actual
74 cat >expect <<'EOF'
75 * (no branch)
76 branch-one
77 branch-two
78 master
79 EOF
80 test_expect_success 'git branch shows detached HEAD properly' '
81 git checkout HEAD^0 &&
82 git branch >actual &&
83 test_i18ncmp expect actual
86 test_done