From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 3/3] abbrev: auto size the default abbreviation
Date: Tue, 01 Nov 2016 18:33:38 -0700 [thread overview]
Message-ID: <xmqqmvhimzrh.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161003222701.za5njew33rqc5b6g@sigill.intra.peff.net> (Jeff King's message of "Mon, 3 Oct 2016 18:27:02 -0400")
Jeff King <peff@peff.net> writes:
> On Fri, Sep 30, 2016 at 05:19:37PM -0700, Junio C Hamano wrote:
>
>> Introduce a mechanism, where we estimate the number of objects in
>> the repository upon the first request to abbreviate an object name
>> with the default setting and come up with a sane default for the
>> repository. Based on the expectation that we would see collision in
>> a repository with 2^(2N) objects when using object names shortened
>> to first N bits, use sufficient number of hexdigits to cover the
>> number of objects in the repository. Each hexdigit (4-bits) we add
>> to the shortened name allows us to have four times (2-bits) as many
>> objects in the repository.
I was idly browsing the draft release notes and then documentation
and noticed that, even though the new default is to auto-scale,
there is no mention of that in the documentation and there is no way
to explicitly ask for auto-scaling.
I wonder if we want to have something like this. I actually am
inclined to drop the change to config.c and remove the new mention
of "auto" in the documentation.
Documentation/config.txt | 9 +++++----
config.c | 14 ++++++++++----
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index a0ab66aae7..b02f8a4025 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -783,10 +783,11 @@ core.sparseCheckout::
linkgit:git-read-tree[1] for more information.
core.abbrev::
- Set the length object names are abbreviated to. If unspecified,
- many commands abbreviate to 7 hexdigits, which may not be enough
- for abbreviated object names to stay unique for sufficiently long
- time.
+ Set the length object names are abbreviated to. If
+ unspecified or set to "auto", an appropriate value is
+ computed based on the approximate number of packed objects
+ in your repository, which hopefully is enough for
+ abbreviated object names to stay unique for some time.
add.ignoreErrors::
add.ignore-errors (deprecated)::
diff --git a/config.c b/config.c
index 83fdecb1bc..c363cca4a9 100644
--- a/config.c
+++ b/config.c
@@ -834,10 +834,16 @@ static int git_default_core_config(const char *var, const char *value)
}
if (!strcmp(var, "core.abbrev")) {
- int abbrev = git_config_int(var, value);
- if (abbrev < minimum_abbrev || abbrev > 40)
- return -1;
- default_abbrev = abbrev;
+ if (!value)
+ return config_error_nonbool(var);
+ if (!strcasecmp(value, "auto"))
+ default_abbrev = -1;
+ else {
+ int abbrev = git_config_int(var, value);
+ if (abbrev < minimum_abbrev || abbrev > 40)
+ return -1;
+ default_abbrev = abbrev;
+ }
return 0;
}
next prev parent reply other threads:[~2016-11-02 1:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-01 0:19 [PATCH 0/3] auto-sizing default abbreviation length Junio C Hamano
2016-10-01 0:19 ` [PATCH 1/3] abbrev: add FALLBACK_DEFAULT_ABBREV to prepare for auto sizing Junio C Hamano
2016-10-01 0:19 ` [PATCH 2/3] abbrev: prepare for new world order Junio C Hamano
2016-10-01 0:19 ` [PATCH 3/3] abbrev: auto size the default abbreviation Junio C Hamano
2016-10-03 22:27 ` Jeff King
2016-10-03 22:34 ` Linus Torvalds
2016-10-03 22:40 ` Jeff King
2016-10-03 22:52 ` Junio C Hamano
2016-10-03 23:47 ` Jeff King
2016-10-04 1:37 ` Junio C Hamano
2016-10-04 12:18 ` Jeff King
2016-11-02 1:33 ` Junio C Hamano [this message]
2016-11-02 2:12 ` Jeff King
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=xmqqmvhimzrh.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.