summaryrefslogtreecommitdiff
path: root/t/t9903-bash-prompt.sh
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2013-06-24 01:55:42 +0200
committerSZEDER Gábor <szeder@ira.uka.de>2013-06-24 17:22:09 +0200
commite8f21caf94287d838cfffe8301b28fdc45480ac8 (patch)
treec86d2cb54cabeb051f221c275896477014db4501 /t/t9903-bash-prompt.sh
parent868dc1acecdb8b661e415c6c5f09db5370b35fa7 (diff)
downloadgit-e8f21caf94287d838cfffe8301b28fdc45480ac8.tar.gz
bash prompt: print unique detached HEAD abbreviated object name
When describing a detached HEAD according to the $GIT_PS1_DESCRIBE environment variable fails, __git_ps1() runs 'cut -c1-7 .git/HEAD' to show the 7 hexdigits abbreviated commit object name in the prompt. Obviously, this neither respects core.abbrev nor produces a unique object name. Fix this by using 'git rev-parse --short HEAD' instead and adjust the corresponding test to use non-standard number of hexdigits. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Diffstat (limited to 't/t9903-bash-prompt.sh')
-rwxr-xr-xt/t9903-bash-prompt.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 416e6219ce..0d53aa6d69 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -50,7 +50,8 @@ test_expect_success SYMLINKS 'prompt - branch name - symlink symref' '
'
test_expect_success 'prompt - detached head' '
- printf " ((%s...))" $(git log -1 --format="%h" b1^) >expected &&
+ printf " ((%s...))" $(git log -1 --format="%h" --abbrev=13 b1^) >expected &&
+ test_config core.abbrev 13 &&
git checkout b1^ &&
test_when_finished "git checkout master" &&
__git_ps1 >"$actual" &&