-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We were not testing the output of "git branch" anywhere. Not only does this not protect us against regressions in the output, but we are not exercising code paths which may have bugs (such as the one fixed by 45e2b61). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information
Jeff King
authored and
Junio C Hamano
committed
Feb 19, 2009
1 parent
66648ad
commit 0afc304
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/sh | ||
|
||
test_description='git branch display tests' | ||
. ./test-lib.sh | ||
|
||
test_expect_success 'make commits' ' | ||
echo content >file && | ||
git add file && | ||
git commit -m one && | ||
echo content >>file && | ||
git commit -a -m two | ||
' | ||
|
||
test_expect_success 'make branches' ' | ||
git branch branch-one | ||
git branch branch-two HEAD^ | ||
' | ||
|
||
test_expect_success 'make remote branches' ' | ||
git update-ref refs/remotes/origin/branch-one branch-one | ||
git update-ref refs/remotes/origin/branch-two branch-two | ||
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/branch-one | ||
' | ||
|
||
cat >expect <<'EOF' | ||
branch-one | ||
branch-two | ||
* master | ||
EOF | ||
test_expect_success 'git branch shows local branches' ' | ||
git branch >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
cat >expect <<'EOF' | ||
origin/HEAD -> origin/branch-one | ||
origin/branch-one | ||
origin/branch-two | ||
EOF | ||
test_expect_success 'git branch -r shows remote branches' ' | ||
git branch -r >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
cat >expect <<'EOF' | ||
branch-one | ||
branch-two | ||
* master | ||
remotes/origin/HEAD -> origin/branch-one | ||
remotes/origin/branch-one | ||
remotes/origin/branch-two | ||
EOF | ||
test_expect_success 'git branch -a shows local and remote branches' ' | ||
git branch -a >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
cat >expect <<'EOF' | ||
two | ||
one | ||
two | ||
EOF | ||
test_expect_success 'git branch -v shows branch summaries' ' | ||
git branch -v >tmp && | ||
awk "{print \$NF}" <tmp >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
cat >expect <<'EOF' | ||
* (no branch) | ||
branch-one | ||
branch-two | ||
master | ||
EOF | ||
test_expect_success 'git branch shows detached HEAD properly' ' | ||
git checkout HEAD^0 && | ||
git branch >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
test_done |