Merge branch 'nk/branch-v-abbrev'

* nk/branch-v-abbrev:
  branch -v: honor core.abbrev
This commit is contained in:
Junio C Hamano 2011-08-28 21:15:33 -07:00
commit 1b76df16d1
2 changed files with 6 additions and 2 deletions

View File

@ -113,7 +113,8 @@ OPTIONS
--abbrev=<length>:: --abbrev=<length>::
Alter the sha1's minimum display length in the output listing. Alter the sha1's minimum display length in the output listing.
The default value is 7. The default value is 7 and can be overridden by the `core.abbrev`
config option.
--no-abbrev:: --no-abbrev::
Display the full sha1s in the output listing rather than abbreviating them. Display the full sha1s in the output listing rather than abbreviating them.

View File

@ -613,7 +613,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int
int cmd_branch(int argc, const char **argv, const char *prefix) int cmd_branch(int argc, const char **argv, const char *prefix)
{ {
int delete = 0, rename = 0, force_create = 0; int delete = 0, rename = 0, force_create = 0;
int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0; int verbose = 0, abbrev = -1, detached = 0;
int reflog = 0; int reflog = 0;
enum branch_track track; enum branch_track track;
int kinds = REF_LOCAL_BRANCH; int kinds = REF_LOCAL_BRANCH;
@ -696,6 +696,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
if (!!delete + !!rename + !!force_create > 1) if (!!delete + !!rename + !!force_create > 1)
usage_with_options(builtin_branch_usage, options); usage_with_options(builtin_branch_usage, options);
if (abbrev == -1)
abbrev = DEFAULT_ABBREV;
if (delete) if (delete)
return delete_branches(argc, argv, delete > 1, kinds); return delete_branches(argc, argv, delete > 1, kinds);
else if (argc == 0) else if (argc == 0)