Skip to content

Commit

Permalink
Teach git-describe to display distances from tags.
Browse files Browse the repository at this point in the history
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.

[jc: still needs documentation and fixups when traversal gives up
 early.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
spearce authored and Junio C Hamano committed Jan 28, 2007
1 parent 46e5e69 commit 237fb6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions builtin-describe.c
Expand Up @@ -191,8 +191,9 @@ static void describe(const char *arg, int last_one)
if (abbrev == 0)
printf("%s\n", all_matches[0].name->path );
else
printf("%s-g%s\n", all_matches[0].name->path,
find_unique_abbrev(cmit->object.sha1, abbrev));
printf("%s-%d-g%s\n", all_matches[0].name->path,
all_matches[0].depth,
find_unique_abbrev(cmit->object.sha1, abbrev));

if (!last_one)
clear_commit_marks(cmit, -1);
Expand Down

0 comments on commit 237fb6c

Please sign in to comment.