Teach git-describe to display distances from tags.
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>
Shawn O. Pearce committed
Jan 25, 2007 at 12:39 UTC
237fb6ca7cbe45f88523ad367d0d703a039dff2d
1 file changed
+3
-2
builtin-describe.c
+3
-2
@@ -191,8 +191,9 @@ static void describe(const char *arg, int last_one)
191
if (abbrev == 0)
192
printf("%s\n", all_matches[0].name->path );
193
else
194
- printf("%s-g%s\n", all_matches[0].name->path,
195
- find_unique_abbrev(cmit->object.sha1, abbrev));
194
+ printf("%s-%d-g%s\n", all_matches[0].name->path,
195
+ all_matches[0].depth,
196
+ find_unique_abbrev(cmit->object.sha1, abbrev));
197
198
if (!last_one)
199
clear_commit_marks(cmit, -1);