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

Re: history damage in linux.git

From
Jeff King <peff@peff.net>
Date
Apr 21, 2016, 17:08 UTC
Message-ID
<20160421170815.GA10783@sigill.intra.peff.net>
In-Reply-To
<xmqqzismsxsu.fsf@gitster.mtv.corp.google.com>
On Thu, Apr 21, 2016 at 09:59:13AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Linus Torvalds <torvalds@linux-foundation.org> writes:
> 
> > That commit aed06b9 can also be described as
> >
> >     v3.13-rc7~9^2~14^2~42
> >
> > so describing it as 'v4.6-rc1~9^2~792' is clearly not closer in any way.
> 
> I seem to recall that name-rev had an unexplained heuristics to
> strongly avoid following second parent changes (I see two ^2 in the
> path from 3.13-rc7 above).

Right, because it makes the names longer. We give the second-parent traversal a heuristic cost. If we drop that cost to "1", like:

diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 092e03c..03be8be 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -17,7 +17,7 @@ typedef struct rev_name {
 static long cutoff = LONG_MAX;
 
 /* How many generations are maximally preferred over _one_ merge traversal? */
-#define MERGE_TRAVERSAL_WEIGHT 65535
+#define MERGE_TRAVERSAL_WEIGHT 1
 
 static void name_rev(struct commit *commit,
 		const char *tip_name, int generation, int distance,


then this case gives:

  v3.13~5^2~4^2~2^2~1^2~42

which is technically true, but kind of painful to read. It may be that a
reasonable weight is somewhere between "1" and "65535", though.

However, I think the more fundamental confusion with git-describe is
that people expect the shortest distance to be the "first" tag that
contained the commit, and that is clearly not true in a branchy history.

I actually think most people would be happy with an algorithm more like:

  1. Find the "oldest" tag (either by timestamp, or by version-sorting
     the tags) that contains the commit in question.

  2. Find the "simplest" path from that tag to the commit, where we
     are striving mostly for shortness of explanation, not of path (so
     "~500" is way better than "~20^2~30^2~14", even though the latter
     is technically a shorter path).

-Peff
Previous: Junio C HamanoNext: Linus Torvalds
Message 11 of 24 in “history damage in linux.git”
  1. Olaf HeringApr 21, 2016
  2. Matthieu MoyApr 21, 2016
  3. Olaf HeringApr 21, 2016
  4. Matthieu MoyApr 21, 2016
  5. John KeepingApr 21, 2016
  6. Olaf HeringApr 21, 2016
  7. Matthieu MoyApr 21, 2016
  8. Andreas SchwabApr 21, 2016
  9. Linus TorvaldsApr 21, 2016
  10. Junio C HamanoApr 21, 2016
  11. Jeff KingApr 21, 2016
  12. Linus TorvaldsApr 21, 2016
  13. Stefan BellerApr 21, 2016
  14. Junio C HamanoApr 21, 2016
  15. Jeff KingApr 21, 2016
  16. Linus TorvaldsApr 21, 2016
  17. Johannes SchindelinApr 22, 2016
  18. Linus TorvaldsApr 21, 2016
  19. Junio C HamanoApr 21, 2016
  20. Linus TorvaldsApr 21, 2016
  21. Linus TorvaldsApr 21, 2016
  22. Jeff KingApr 21, 2016
  23. Junio C HamanoApr 21, 2016
  24. Linus TorvaldsApr 21, 2016

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.