aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-28 11:28:04 -0700
committerJunio C Hamano <gitster@pobox.com>2011-03-11 14:42:54 -0800
commitdce96489162b05ae3463741f7f0365ff56f0de36 (patch)
treeb342bc64b96a6553e58c0a29a1225c0d7832e9b4 /cache.h
parent7ed863a85a6ce2c4ac4476848310b8f917ab41f9 (diff)
downloadgit-dce96489162b05ae3463741f7f0365ff56f0de36.tar.gz
git-dce96489162b05ae3463741f7f0365ff56f0de36.tar.xz
Make the default abbrev length configurable
The default of 7 comes from fairly early in git development, when seven hex digits was a lot (it covers about 250+ million hash values). Back then I thought that 65k revisions was a lot (it was what we were about to hit in BK), and each revision tends to be about 5-10 new objects or so, so a million objects was a big number. These days, the kernel isn't even the largest git project, and even the kernel has about 220k revisions (_much_ bigger than the BK tree ever was) and we are approaching two million objects. At that point, seven hex digits is still unique for a lot of them, but when we're talking about just two orders of magnitude difference between number of objects and the hash size, there _will_ be collisions in truncated hash values. It's no longer even close to unrealistic - it happens all the time. We should both increase the default abbrev that was unrealistically small, _and_ add a way for people to set their own default per-project in the git config file. This is the first step to first make it configurable; the default of 7 is not raised yet. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/cache.h b/cache.h
index d83d68c85..8d73d8896 100644
--- a/cache.h
+++ b/cache.h
@@ -540,6 +540,7 @@ extern int trust_executable_bit;
extern int trust_ctime;
extern int quote_path_fully;
extern int has_symlinks;
+extern int minimum_abbrev, default_abbrev;
extern int ignore_case;
extern int assume_unchanged;
extern int prefer_symlink_refs;
@@ -758,8 +759,8 @@ static inline unsigned int hexval(unsigned char c)
}
/* Convert to/from hex/sha1 representation */
-#define MINIMUM_ABBREV 4
-#define DEFAULT_ABBREV 7
+#define MINIMUM_ABBREV minimum_abbrev
+#define DEFAULT_ABBREV default_abbrev
struct object_context {
unsigned char tree[20];