checkout: describe_detached_head: remove ellipsis after committish
We do not want an ellipsis displayed following an (abbreviated) SHA-1
value.
The days when this was necessary to indicate the truncation to
lower-level Git commands and/or the user are bygone.
However, to ease the transition, the ellipsis will still be printed if
the user sets the environment variable GIT_PRINT_SHA1_ELLIPSIS to "yes".
Correct documentation with respect to what describe_detached_head prints
when GIT_PRINT_SHA1_ELLIPSIS is not set as indicated above.
Add tests for the old and new behaviour.
Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
@ -319,7 +319,7 @@ do so (now or later) by using -b with the checkout command again. Example:
@@ -319,7 +319,7 @@ do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 427abfa... Linux v2.6.17
HEAD is now at 427abfa Linux v2.6.17
------------------------------------------------
The HEAD then refers to the SHA-1 of the commit instead of to a branch,
@ -186,4 +186,127 @@ test_expect_success 'no advice given for explicit detached head state' '
@@ -186,4 +186,127 @@ test_expect_success 'no advice given for explicit detached head state' '
test_cmp expect.no-advice actual
'
# Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (new format)
test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not asked to' "
# The first detach operation is more chatty than the following ones.
cat >1st_detach <<-'EOF' &&
Note: checking out 'HEAD^'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 7c7cd714e262 three
EOF
# The remaining ones just show info about previous and current HEADs.