Skip to content

Commit 6dbbae1

Browse files
committed
Merge branch 'ew/decline-core-abbrev'
The configuration variable 'core.abbrev' can be set to 'no' to force no abbreviation regardless of the hash algorithm. * ew/decline-core-abbrev: core.abbrev=no disables abbreviations
2 parents 72c4083 + a9ecaa0 commit 6dbbae1

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

Documentation/config/core.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,4 +625,6 @@ core.abbrev::
625625
computed based on the approximate number of packed objects
626626
in your repository, which hopefully is enough for
627627
abbreviated object names to stay unique for some time.
628+
If set to "no", no abbreviation is made and the object names
629+
are shown in their full length.
628630
The minimum length is 4.

config.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,8 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
12171217
return config_error_nonbool(var);
12181218
if (!strcasecmp(value, "auto"))
12191219
default_abbrev = -1;
1220+
else if (!git_parse_maybe_bool_text(value))
1221+
default_abbrev = the_hash_algo->hexsz;
12201222
else {
12211223
int abbrev = git_config_int(var, value);
12221224
if (abbrev < minimum_abbrev || abbrev > the_hash_algo->hexsz)

t/t3200-branch.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ test_expect_success 'git branch --list -v with --abbrev' '
306306
307307
git branch -v --list --no-abbrev t >actual.noabbrev &&
308308
git branch -v --list --abbrev=0 t >actual.0abbrev &&
309+
git -c core.abbrev=no branch -v --list t >actual.noabbrev-conf &&
309310
test_cmp actual.noabbrev actual.0abbrev &&
311+
test_cmp actual.noabbrev actual.noabbrev-conf &&
310312
311313
git branch -v --list --abbrev=36 t >actual.36abbrev &&
312314
# how many hexdigits are used?

0 commit comments

Comments
 (0)