summaryrefslogtreecommitdiff
path: root/describe.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-01-25 09:03:18 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-01-28 08:09:38 (GMT)
commit46a6c2620ba421397eec627b8eb18eb530e694fc (patch)
tree9222e809b0d77ad10e7304073d4c053c7edd9266 /describe.c
parent6b94f1e404afc552e5139c4357331843f5be61ad (diff)
downloadgit-46a6c2620ba421397eec627b8eb18eb530e694fc.zip
git-46a6c2620ba421397eec627b8eb18eb530e694fc.tar.gz
git-46a6c2620ba421397eec627b8eb18eb530e694fc.tar.bz2
abbrev cleanup: use symbolic constants
The minimum length of abbreviated object name was hardcoded in different places to be 4, risking inconsistencies in the future. Also there were three different "default abbreviation precision". Use two C preprocessor symbols to clean up this mess. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'describe.c')
-rw-r--r--describe.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/describe.c b/describe.c
index 4866510..ff65742 100644
--- a/describe.c
+++ b/describe.c
@@ -11,7 +11,6 @@ static const char describe_usage[] =
static int all = 0; /* Default to annotated tags only */
static int tags = 0; /* But allow any tags if --tags is specified */
-#define DEFAULT_ABBREV 8 /* maybe too many */
static int abbrev = DEFAULT_ABBREV;
static int names = 0, allocs = 0;
@@ -155,7 +154,7 @@ int main(int argc, char **argv)
tags = 1;
else if (!strncmp(arg, "--abbrev=", 9)) {
abbrev = strtoul(arg + 9, NULL, 10);
- if (abbrev < 4 || 40 <= abbrev)
+ if (abbrev < MINIMUM_ABBREV || 40 <= abbrev)
abbrev = DEFAULT_ABBREV;
}
else