From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Namhyung Kim <namhyung@gmail.com>
Subject: Re: [PATCH] find_unique_abbrev(): honor caller-supplied "len" better
Date: Thu, 10 Mar 2011 15:07:59 -0800 [thread overview]
Message-ID: <AANLkTimH9=OWD4+dPsdYaL2VPdDkTsUG_N3GBf168XqD@mail.gmail.com> (raw)
In-Reply-To: <7vhbba38mm.fsf_-_@alter.siamese.dyndns.org>
On Thu, Mar 10, 2011 at 2:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> The code however forgot that the function may be called with a "len" that
> is long enough. If an object is uniquely identifiable with only 4 leading
> characters today, and if the caller gives 7 as len and the guard is set to
> 3, it returned 10 hexdigits, which was 3 characters longer than necessary.
> We should instead return 7 leading characters in such a case, as that is
> in line with the original intention of using 3 characters more than
> absolutely necessary to give the disambiguation we find today a better
> chance to survive.
The thing is, that just makes the notion of "abbrevguard" pointless.
Why have it?
When you pass in 6 as a len, and that isn't sufficient, it expands it
to (say) 10. And then you pass in 7 as a length, and now it's
sufficient, so it keeps it at 7.
That's just stupid. You gave it a bigger length suggestion, and you
got a smaller end result. That's crazy.
However, I think the _real_ problem is not whether that behavior is
really stupid or not. I think the real problem is that abbrevguard
really isn't a well-defined, and you get this kind of crazy semantics.
So I think the REAL problem is different:
(a) DEFAULT_ABBREV is just too damn small. 7 made sense as a random
number back when we did this, but we're talking over 5 years ago. The
seven comes from commit 47dd0d595d04e. Back then, a million objects
was a really almost inconceivably big number. Even the BK tree (that
I was going by as a target) was just 65k revisions for Linux, so with
most changes only touching a few files, "million" was "long time in
the future". Now we're close to 2 million.
It turns out 640kB isn't enough for everybody. For the kernel, we have
several objects that need 10 digits just for uniqeness right NOW.. 12
digits is a _somewhat_ reasonable safe value for the forseeable
future. But 11 would be too short. And I don't think the kernel is the
biggest repo.
(b) You can't change DEFAULT_ABBREV except with the command line option.
(c) Even there it's unnecessarily hard. Want to see your commit
numbers abbreviated appropriately too? Oh, you have to use
"--abbrev=12 --abbrev-commit". We didn't think the interface through.
(d) some places don't even take the command line option. Grep for
DEFAULT_ABBREV, and notice how often it's just used as-is.
So I would suggest ditching 'unique_abbrev_extra_length' entirely. I
doubt anybody uses it, and the whole concept is simply badly designed
with crazy semantics as per your patch.
Linus
next prev parent reply other threads:[~2011-03-10 23:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1PBKT9-0004Uk-Sm@tytso-glaptop>
[not found] ` <20101028075631.GA7690@elte.hu>
[not found] ` <AANLkTi=8SbOZizWpxLg=Bgp7atdgr8MsR6tnRDYr1+eW@mail.gmail.com>
[not found] ` <20101028163854.GA15450@elte.hu>
[not found] ` <AANLkTin62vAwJxcsrFk6Yn7Q6tzr-D=EmKKwPazuAJ11@mail.gmail.com>
[not found] ` <20101028171701.GA18368@elte.hu>
2010-10-28 17:27 ` Minimum git commit abbrev length (Was Re: -tip: origin tree build failure (was: [GIT PULL] ext4 update) for 2.6.37) Ted Ts'o
2010-10-28 18:28 ` Linus Torvalds
2010-10-28 18:54 ` Linus Torvalds
2010-10-29 0:14 ` Minimum git commit abbrev length (Was Re: -tip: origin tree build failure Brandon Casey
[not found] ` <7veiba9ev2.fsf@alter.siamese.dyndns.org>
2011-03-10 22:37 ` [PATCH] find_unique_abbrev(): honor caller-supplied "len" better Junio C Hamano
2011-03-10 23:07 ` Linus Torvalds [this message]
2011-03-11 0:40 ` Junio C Hamano
2011-03-11 1:16 ` Linus Torvalds
2011-03-11 1:33 ` Junio C Hamano
2011-03-11 2:21 ` Linus Torvalds
2011-03-11 3:09 ` Junio C Hamano
2011-03-11 3:03 ` Junio C Hamano
2011-03-11 5:22 ` Jeff King
2011-03-11 5:33 ` Jeff King
2011-03-11 22:45 ` Junio C Hamano
2011-03-13 13:30 ` Namhyung Kim
2011-03-19 1:22 ` Jay Soffian
2011-03-19 16:24 ` Namhyung Kim
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='AANLkTimH9=OWD4+dPsdYaL2VPdDkTsUG_N3GBf168XqD@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=namhyung@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.
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).