git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Match lightweight tags too in bash prompt

From
knittl <knittl89@googlemail.com>
Date
Nov 19, 2010, 15:43 UTC
Message-ID
<AANLkTikeH=MODho_GsZP5VPQmt2NOoHyfw2pbt4yqGkt@mail.gmail.com>
>From 1fea30e0167681917b4f40a3cb2cde9a90706011 Mon Sep 17 00:00:00 2001
From: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Date: Fri, 19 Nov 2010 16:40:02 +0100
Subject: [PATCH] Match lightweight tags too in bash prompt

provide `--tags` to git describe ---

bash prompt would display a commit's sha1, when checking out a lightweight tag. provide --tags to git describe in the completion script, so it will display the name of the tag (as it already does for annotated tags)

 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash
b/contrib/completion/git-completion.bash
index f710469..604fa79 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -261,7 +261,7 @@ __git_ps1 ()
 				(describe)
 					git describe HEAD ;;
 				(* | default)
-					git describe --exact-match HEAD ;;
+					git describe --tags --exact-match HEAD ;;
 				esac 2>/dev/null)" ||

 				b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
-- 
1.7.3.2.334.gd1031


-- 
typed with http://neo-layout.org
myFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!
Next: Shawn Pearce
Message 1 of 4 in “Match lightweight tags too in bash prompt”
  1. Match lightweight tags too in bash promptknittl, Nov 19, 2010
  2. Shawn PearceNov 30, 2010
  3. knittlNov 30, 2010
  4. Thiago FarinaDec 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.