summaryrefslogtreecommitdiff
path: root/t/t3203-branch-output.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t3203-branch-output.sh')
-rwxr-xr-xt/t3203-branch-output.sh39
1 files changed, 38 insertions, 1 deletions
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index ba4f98e..f51d0f3 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -96,7 +96,7 @@ test_expect_success 'git branch -v pattern does not show branch summaries' '
test_expect_success 'git branch shows detached HEAD properly' '
cat >expect <<EOF &&
-* (detached from $(git rev-parse --short HEAD^0))
+* (HEAD detached at $(git rev-parse --short HEAD^0))
branch-one
branch-two
master
@@ -106,4 +106,41 @@ EOF
test_i18ncmp expect actual
'
+test_expect_success 'git branch shows detached HEAD properly after moving' '
+ cat >expect <<EOF &&
+* (HEAD detached from $(git rev-parse --short HEAD))
+ branch-one
+ branch-two
+ master
+EOF
+ git reset --hard HEAD^1 &&
+ git branch >actual &&
+ test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch shows detached HEAD properly from tag' '
+ cat >expect <<EOF &&
+* (HEAD detached at fromtag)
+ branch-one
+ branch-two
+ master
+EOF
+ git tag fromtag master &&
+ git checkout fromtag &&
+ git branch >actual &&
+ test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch shows detached HEAD properly after moving from tag' '
+ cat >expect <<EOF &&
+* (HEAD detached from fromtag)
+ branch-one
+ branch-two
+ master
+EOF
+ git reset --hard HEAD^1 &&
+ git branch >actual &&
+ test_i18ncmp expect actual
+'
+
test_done