From: Namhyung Kim <namhyung@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] branch: honor core.abbrev
Date: Fri, 1 Jul 2011 01:02:42 +0900 [thread overview]
Message-ID: <1309449762-10476-1-git-send-email-namhyung@gmail.com> (raw)
Honor 'core.abbrev' configuration unless user specifies the
length on command line. In order to do that, we need to set
'abbrev' to DEFAULT_ABBREV after config and command line
parsing done.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
Documentation/git-branch.txt | 1 +
builtin/branch.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index c50f189..906cccc 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -114,6 +114,7 @@ OPTIONS
--abbrev=<length>::
Alter the sha1's minimum display length in the output listing.
The default value is 7.
+ (and can be overrided by the `core.abbrev` config option).
--no-abbrev::
Display the full sha1s in the output listing rather than abbreviating them.
diff --git a/builtin/branch.c b/builtin/branch.c
index d6ab93b..5a15022 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -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 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;
enum branch_track track;
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)
usage_with_options(builtin_branch_usage, options);
+ if (abbrev == -1)
+ abbrev = DEFAULT_ABBREV;
+
if (delete)
return delete_branches(argc, argv, delete > 1, kinds);
else if (argc == 0)
--
1.7.6
next reply other threads:[~2011-06-30 16:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 16:02 Namhyung Kim [this message]
2011-06-30 18:10 ` [PATCH] branch: honor core.abbrev Jonathan Nieder
2011-07-01 6:06 ` [PATCH v2] " Namhyung Kim
2011-07-01 18:21 ` Junio C Hamano
2011-07-01 19:05 ` Jonathan Nieder
2011-07-02 1:32 ` [PATCH] " Jonathan Nieder
2011-06-30 18:27 ` Andreas Schwab
2011-07-01 6:10 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1309449762-10476-1-git-send-email-namhyung@gmail.com \
--to=namhyung@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).