git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Olaf Hering <olaf@aepfle.de>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: history damage in linux.git
Date: Thu, 21 Apr 2016 13:08:15 -0400	[thread overview]
Message-ID: <20160421170815.GA10783@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqzismsxsu.fsf@gitster.mtv.corp.google.com>

On Thu, Apr 21, 2016 at 09:59:13AM -0700, Junio C Hamano wrote:

> 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

  reply	other threads:[~2016-04-21 17:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 11:30 history damage in linux.git Olaf Hering
2016-04-21 12:10 ` Matthieu Moy
2016-04-21 12:32   ` Olaf Hering
2016-04-21 12:51     ` Matthieu Moy
2016-04-21 13:19 ` John Keeping
2016-04-21 15:54   ` Olaf Hering
2016-04-21 16:36     ` Matthieu Moy
2016-04-21 13:24 ` Andreas Schwab
2016-04-21 16:36   ` Linus Torvalds
2016-04-21 16:59     ` Junio C Hamano
2016-04-21 17:08       ` Jeff King [this message]
2016-04-21 17:23         ` Linus Torvalds
2016-04-21 17:44           ` Stefan Beller
2016-04-21 22:16             ` Junio C Hamano
2016-04-21 18:05           ` Jeff King
2016-04-21 18:18             ` Linus Torvalds
2016-04-22 13:38               ` Johannes Schindelin
2016-04-21 17:00     ` Linus Torvalds
2016-04-21 17:23       ` Junio C Hamano
2016-04-21 17:43         ` Linus Torvalds
2016-04-21 17:59           ` Linus Torvalds
2016-04-21 18:09             ` Jeff King
2016-04-21 19:27           ` Junio C Hamano
2016-04-21 19:43             ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160421170815.GA10783@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=olaf@aepfle.de \
    --cc=schwab@linux-m68k.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).