{"thread":{"id":"12288","subject":"[PATCH 6/6] Use git-describe --exact-match in bash prompt on detached HEAD","startedAt":"2008-02-24T08:07:33Z","lastAt":"2008-02-24T08:07:33Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"69768","messageId":"20080224080733.GF22587@spearce.org","threadId":"12288","inReplyTo":null,"subject":"[PATCH 6/6] Use git-describe --exact-match in bash prompt on detached HEAD","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-02-24T08:07:33Z","receivedAt":"2008-02-24T08:07:33Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Most of the time when I am on a detached HEAD and I am not doing\na rebase or bisect operation the working directory is sitting on a\ntagged release of the repository.  Showing the tag name instead of\nthe commit SHA-1 is much more descriptive and a much better reminder\nof the state of this working directory.\n\nNow that git-describe --exact-match is available as a cheap means\nof obtaining the exact annotated tag or nothing at all, we can\nfavor the annotated tag name over the abbreviated commit SHA-1.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n contrib/completion/git-completion.bash |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 4ea727b..8722a68 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -91,7 +91,10 @@ __git_ps1 ()\n \t\t\tfi\n \t\t\tif ! b=\"$(git symbolic-ref HEAD 2>/dev/null)\"\n \t\t\tthen\n-\t\t\t\tb=\"$(cut -c1-7 $g/HEAD)...\"\n+\t\t\t\tif ! b=\"$(git describe --exact-match HEAD 2>/dev/null)\"\n+\t\t\t\tthen\n+\t\t\t\t\tb=\"$(cut -c1-7 $g/HEAD)...\"\n+\t\t\t\tfi\n \t\t\tfi\n \t\tfi\n \n-- \n1.5.4.3.295.g6b554\n"}]}