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

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

From
Junio C Hamano <junkio@cox.net>
Date
Jan 25, 2007, 21:26 UTC
Message-ID
<7vmz46ajcq.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070125173954.GA13276@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 24 quoted lines
> 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)
Two comments.
 - This is purely style, but we seem to prefer %d instead of %i
   elsewhere in the code (three existing offenders are
   builtin-describe.c, receive-pack.c and sha1_file which we may
   want to clean up for consistency).
 - How much damage are we talking about with this patch to
   People's existing scripts?  I expect they all extract the
   hash from last -g (because they cannot rely on particular
   convention in tagnames), but I am also worried if people are
   expecting everything that comes before the last -g is the
   whole tag.
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 2 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.