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

[PATCH 1/2] Teach git-describe to display distances from tags.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 25, 2007, 17:39 UTC
Message-ID
<20070125173954.GA13276@spearce.org>
Junio C Hamano <junkio@cox.net>:
Show 14 quoted lines
> However, I suspect that we could do better with Shawn's new
> fangled describe implementation that actually counts the
> distance between what is described and the tag.  We could add
> "number of commits since the tag" somewhere, to describe:
>
>   v2.6.20-rc5-256-g419dd83
>   v2.6.20-rc5-217-gde14569
>
> to say that the first one has 256 commits accumulated since the
> given tag "v2.6.20-rc5" and the second one has only 217
> commits, to get the sense of how busy the development activity
> is.
>
> Is it useful?  That is something I am not sure.

Yes, its very useful. If you get two different describes at different times from a non-rewinding branch and they both come up with the same tag name, you can tell which is the 'newer' one by distance. This is rather common in practice, so its incredibly useful.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 builtin-describe.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-describe.c b/builtin-describe.c
index e7b8f95..d8ff621 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -189,7 +189,8 @@ static void describe(const char *arg, int last_one)
 				sha1_to_hex(gave_up_on->object.sha1));
 		}
 	}
-	printf("%s-g%s\n", all_matches[0].name->path,
+	printf("%s-%i-g%s\n", all_matches[0].name->path,
+		   all_matches[0].depth,
 		   find_unique_abbrev(cmit->object.sha1, abbrev));
 
 	if (!last_one)
-- 
1.5.0.rc2.g18af
Next: Junio C Hamano
Message 1 of 15 in “Teach git-describe to display distances from tags.”
  1. 1/2 Teach git-describe to display distances from tags.Shawn O. Pearce, Jan 25, 2007
  2. Junio C HamanoJan 25, 2007
  3. Shawn O. PearceJan 25, 2007
  4. Junio C HamanoJan 25, 2007
  5. Shawn O. PearceJan 25, 2007
  6. Nicolas PitreJan 25, 2007
  7. Junio C HamanoJan 26, 2007
  8. Francis MoreauJan 26, 2007
  9. Junio C HamanoJan 26, 2007
  10. Francis MoreauJan 26, 2007
  11. Shawn O. PearceJan 26, 2007
  12. Andy ParkinsJan 26, 2007
  13. If abbrev is set to zero in git-describe, don't add the unique suffixAndy Parkins, Jan 26, 2007
  14. Jakub NarebskiJan 26, 2007
  15. Matthias LederhoferJan 26, 2007

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.