git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] blame: honor core.abbrev
Date: Fri,  1 Apr 2011 10:54:56 +0900	[thread overview]
Message-ID: <1301622896-5836-2-git-send-email-namhyung@gmail.com> (raw)
In-Reply-To: <1301622896-5836-1-git-send-email-namhyung@gmail.com>

If user sets config.abbrev option, use it as if --abbrev was given.
We can't set abbrev to default_abbrev unconditionally IMHO, because
historically default abbrev length of the blame command is 8 and
DEFAULT_ABBREV is 7.

As you may see, this is the default value and user can use different
abbrev length by specifing --abbrev=N command line option.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 builtin/blame.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 253b480..93693d2 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2317,12 +2317,16 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 
 	struct parse_opt_ctx_t ctx;
 	int cmd_is_annotate = !strcmp(argv[0], "annotate");
+	int orig_abbrev = DEFAULT_ABBREV;
 
 	git_config(git_blame_config, NULL);
 	init_revisions(&revs, NULL);
 	revs.date_mode = blame_date_mode;
 	DIFF_OPT_SET(&revs.diffopt, ALLOW_TEXTCONV);
 
+	/* if user sets config.abbrev, honor it */
+	if (orig_abbrev != default_abbrev)
+		abbrev = default_abbrev;
 	save_commit_buffer = 0;
 	dashdash_pos = 0;
 
-- 
1.7.4

  reply	other threads:[~2011-04-01  1:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01  1:54 [PATCH 1/2] blame: add --abbrev command line option Namhyung Kim
2011-04-01  1:54 ` Namhyung Kim [this message]
2011-04-01 22:44   ` [PATCH 2/2] blame: honor core.abbrev Junio C Hamano
2011-04-02  1:37     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301622896-5836-2-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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).