branch -v: honor core.abbrev

Use the value from 'core.abbrev' configuration variable unless user specifies the length on command line when showing commit object name in "branch -v" output. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Namhyung Kim committed Jul 1, 2011 at 15:06 UTC b792c067872a6b4ec6545dc4375a7084626cb0fa
2 files changed +6 -2
Documentation/git-branch.txt
+2 -1
@@ -113,7 +113,8 @@ OPTIONS
113
114 --abbrev=<length>::
115 Alter the sha1's minimum display length in the output listing.
116 - The default value is 7.
116 + The default value is 7 and can be overridden by the `core.abbrev`
117 + config option.
118
119 --no-abbrev::
120 Display the full sha1s in the output listing rather than abbreviating them.
builtin/branch.c
+4 -1
@@ -613,7 +613,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int
613 int cmd_branch(int argc, const char **argv, const char *prefix)
614 {
615 int delete = 0, rename = 0, force_create = 0;
616 - int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0;
616 + int verbose = 0, abbrev = -1, detached = 0;
617 int reflog = 0;
618 enum branch_track track;
619 int kinds = REF_LOCAL_BRANCH;
@@ -696,6 +696,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
696 if (!!delete + !!rename + !!force_create > 1)
697 usage_with_options(builtin_branch_usage, options);
698
699 + if (abbrev == -1)
700 + abbrev = DEFAULT_ABBREV;
701 +
702 if (delete)
703 return delete_branches(argc, argv, delete > 1, kinds);
704 else if (argc == 0)