From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Elijah Newren" <newren@gmail.com>,
"Elijah Newren" <newren@gmail.com>,
"Elijah Newren" <newren@gmail.com>
Subject: Re: [PATCH v2] name-rev: prefer shorter names over following merges
Date: Wed, 8 Dec 2021 12:38:19 +0100 (CET) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.2112081237310.90@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <pull.1119.v2.git.git.1638596152340.gitgitgadget@gmail.com>
Hi Elijah,
On Sat, 4 Dec 2021, Elijah Newren via GitGitGadget wrote:
> Range-diff vs v1:
>
> 1: 50812ed6fdf ! 1: 5d068486f9f name-rev: prefer shorter names over following merges
> @@ Commit message
> the printed name over fewer total parent traversals performed to get the
> answer.
>
> + == Side-note on tie-breakers ==
> +
> + When there are the same number of segments for two different names, we
> + actually use the name of an ancestor commit as a tie-breaker as well.
> + For example, for the commit cbdca289fb in the git.git repository, we
> + prefer the name v2.33.0-rc0~112^2~1 over v2.33.0-rc0~57^2~5. This is
> + because:
> +
> + * cbdca289fb is the parent of 25e65b6dd5, which implies the name for
> + cbdca289fb should be the first parent of the preferred name for
> + 25e65b6dd5
> + * 25e65b6dd5 could be named either v2.33.0-rc0~112^2 or
> + v2.33.0-rc0~57^2~4, but the former is preferred over the latter due
> + to fewer segments
> + * combine the two previous facts, and the name we get for cbdca289fb
> + is "v2.33.0-rc0~112^2~1" rather than "v2.33.0-rc0~57^2~5".
> +
> + Technically, we get this for free out of the implementation since we
> + only keep track of one name for each commit as we walk history (and
> + re-add parents to the queue if we find a better name for those parents),
> + but the first bullet point above ensures users get results that feel
> + more consistent.
> +
> + == Alternative Ideas and Meanings Discussed ==
> +
> + One suggestion that came up during review was that shortest
> + string-length might be easiest for users to consume. However, such a
> + scheme would be rather computationally expensive (we'd have to track all
> + names for each commit as we traversed the graph) and would additionally
> + come with the possibly perplexing result that on a linear segment of
> + history we could rapidly swap back and forth on names:
> + MYTAG~3^2 would be preferred over MYTAG~9998
> + MYTAG~3^2~1 would NOT be preferred over MYTAG~9999
> + MYTAG~3^2~2 might be preferred over MYTAG~10000
> +
> + Another item that came up was possible auxiliary semantic meanings for
> + name-rev results either before or after this patch. The basic answer
> + was that the previous implementation had no known useful auxiliary
> + semantics, but that for many repositories (most in my experience), the
> + new scheme does. In particular, the new name-rev output can often be
> + used to answer the question, "How or when did this commit get merged?"
> + Since that usefulness depends on how merges happen within the repository
> + and thus isn't universally applicable, details are omitted here but you
> + can see them at [1].
> +
> + [1] https://lore.kernel.org/git/CABPp-BEeUM+3NLKDVdak90_UUeNghYCx=Dgir6=8ixvYmvyq3Q@mail.gmail.com/
> +
> + Finally, it was noted that the algorithm could be improved by just
> + explicitly tracking the number of segments and using both it and
> + distance in the comparison, instead of giving a magic number that tries
> + to blend the two (and which therefore might give suboptimal results in
> + repositories with really huge numbers of commits that periodically merge
> + older code). However, "[this patch] seems to give us a much better
> + results than the current code, so let's take it and leave further
> + futzing outside the scope."
> +
> Signed-off-by: Elijah Newren <newren@gmail.com>
Very nice addition!
And obviously, I am still in favor of moving this patch along in the
direction of `main`.
Thank you,
Dscho
prev parent reply other threads:[~2021-12-08 11:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-13 0:14 [PATCH] name-rev: prefer shorter names over following merges Elijah Newren via GitGitGadget
2021-11-13 9:42 ` Ævar Arnfjörð Bjarmason
2021-11-13 19:35 ` Elijah Newren
2021-11-16 12:13 ` Johannes Schindelin
2021-11-17 8:49 ` Junio C Hamano
2021-12-04 5:35 ` [PATCH v2] " Elijah Newren via GitGitGadget
2021-12-08 11:38 ` Johannes Schindelin [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.QRO.7.76.6.2112081237310.90@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).