* [PATCH v2 1/3] blame: add --abbrev command line option
@ 2011-04-06 2:20 Namhyung Kim
2011-04-06 2:20 ` [PATCH v2 2/3] blame: honor core.abbrev Namhyung Kim
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Namhyung Kim @ 2011-04-06 2:20 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
builtin/blame.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index f6b03f7..253b480 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -41,6 +41,7 @@ static int reverse;
static int blank_boundary;
static int incremental;
static int xdl_opts;
+static int abbrev = 8;
static enum date_mode blame_date_mode = DATE_ISO8601;
static size_t blame_date_width;
@@ -1670,7 +1671,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
cp = nth_line(sb, ent->lno);
for (cnt = 0; cnt < ent->num_lines; cnt++) {
char ch;
- int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;
+ int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : abbrev;
if (suspect->commit->object.flags & UNINTERESTING) {
if (blank_boundary)
@@ -2310,6 +2311,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
{ OPTION_CALLBACK, 'C', NULL, &opt, "score", "Find line copies within and across files", PARSE_OPT_OPTARG, blame_copy_callback },
{ OPTION_CALLBACK, 'M', NULL, &opt, "score", "Find line movements within and across files", PARSE_OPT_OPTARG, blame_move_callback },
OPT_CALLBACK('L', NULL, &bottomtop, "n,m", "Process only line range n,m, counting from 1", blame_bottomtop_callback),
+ OPT__ABBREV(&abbrev),
OPT_END()
};
--
1.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] blame: honor core.abbrev
2011-04-06 2:20 [PATCH v2 1/3] blame: add --abbrev command line option Namhyung Kim
@ 2011-04-06 2:20 ` Namhyung Kim
2011-04-06 2:20 ` [PATCH v2 3/3] Documentation: add --abbrev option to the man page of git blame Namhyung Kim
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2011-04-06 2:20 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
If user sets config.abbrev option, use it as if --abbrev was given.
This is the default value and user can override different abbrev
length by specifing --abbrev=N command line option.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
builtin/blame.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index 253b480..4639788 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -41,7 +41,7 @@ static int reverse;
static int blank_boundary;
static int incremental;
static int xdl_opts;
-static int abbrev = 8;
+static int abbrev = -1;
static enum date_mode blame_date_mode = DATE_ISO8601;
static size_t blame_date_width;
@@ -2347,6 +2347,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
parse_done:
argc = parse_options_end(&ctx);
+ if (abbrev == -1)
+ abbrev = default_abbrev;
+ /* one more abbrev length is needed for the boundary commit */
+ abbrev++;
+
if (revs_file && read_ancestry(revs_file))
die_errno("reading graft file '%s' failed", revs_file);
--
1.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] Documentation: add --abbrev option to the man page of git blame
2011-04-06 2:20 [PATCH v2 1/3] blame: add --abbrev command line option Namhyung Kim
2011-04-06 2:20 ` [PATCH v2 2/3] blame: honor core.abbrev Namhyung Kim
@ 2011-04-06 2:20 ` Namhyung Kim
2011-04-06 2:46 ` [PATCH v2 1/3] blame: add --abbrev command line option Thiago Farina
2011-04-06 3:18 ` Junio C Hamano
3 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2011-04-06 2:20 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
Documentation/git-blame.txt | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index c4d1ff8..27ce6bd 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental] [-L n,m]
- [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
+ [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>] [--abbrev=<n>]
[<rev> | --contents <file> | --reverse <rev>] [--] <file>
DESCRIPTION
@@ -73,6 +73,12 @@ include::blame-options.txt[]
Ignore whitespace when comparing the parent's version and
the child's to find where the lines came from.
+--abbrev=<n>::
+ Instead of using the default 7+1 hexadecimal digits as the
+ abbreviated object name, use <n>+1 digits. Note that git
+ will add 1 for the boundary commit to be distinguished (with
+ a caret at the beginning).
+
THE PORCELAIN FORMAT
--------------------
--
1.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] blame: add --abbrev command line option
2011-04-06 2:20 [PATCH v2 1/3] blame: add --abbrev command line option Namhyung Kim
2011-04-06 2:20 ` [PATCH v2 2/3] blame: honor core.abbrev Namhyung Kim
2011-04-06 2:20 ` [PATCH v2 3/3] Documentation: add --abbrev option to the man page of git blame Namhyung Kim
@ 2011-04-06 2:46 ` Thiago Farina
2011-04-06 3:18 ` Junio C Hamano
3 siblings, 0 replies; 6+ messages in thread
From: Thiago Farina @ 2011-04-06 2:46 UTC (permalink / raw
To: Namhyung Kim; +Cc: Junio C Hamano, git
On Tue, Apr 5, 2011 at 11:20 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> builtin/blame.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/builtin/blame.c b/builtin/blame.c
> index f6b03f7..253b480 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -41,6 +41,7 @@ static int reverse;
> static int blank_boundary;
> static int incremental;
> static int xdl_opts;
> +static int abbrev = 8;
>
> static enum date_mode blame_date_mode = DATE_ISO8601;
> static size_t blame_date_width;
> @@ -1670,7 +1671,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
> cp = nth_line(sb, ent->lno);
> for (cnt = 0; cnt < ent->num_lines; cnt++) {
> char ch;
> - int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;
> + int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : abbrev;
Should this 40 be a constant?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] blame: add --abbrev command line option
2011-04-06 2:20 [PATCH v2 1/3] blame: add --abbrev command line option Namhyung Kim
` (2 preceding siblings ...)
2011-04-06 2:46 ` [PATCH v2 1/3] blame: add --abbrev command line option Thiago Farina
@ 2011-04-06 3:18 ` Junio C Hamano
2011-04-06 11:06 ` Namhyung Kim
3 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2011-04-06 3:18 UTC (permalink / raw
To: Namhyung Kim; +Cc: git
Thanks.
As the meaning of the option changes between 1/3 and 2/3, let's squash
these three patches into a single commit. Here is what I've tentatively
queued.
commit 84393bfd731c435120dc1dda63432a70124821cb
Author: Namhyung Kim <namhyung@gmail.com>
Date: Wed Apr 6 11:20:50 2011 +0900
blame: add --abbrev command line option and make it honor core.abbrev
If user sets config.abbrev option, use it as if --abbrev was given. This
is the default value and user can override different abbrev length by
specifying the --abbrev=N command line option.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] blame: add --abbrev command line option
2011-04-06 3:18 ` Junio C Hamano
@ 2011-04-06 11:06 ` Namhyung Kim
0 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2011-04-06 11:06 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
2011-04-05 (화), 20:18 -0700, Junio C Hamano:
> Thanks.
>
> As the meaning of the option changes between 1/3 and 2/3, let's squash
> these three patches into a single commit. Here is what I've tentatively
> queued.
>
Great! Thanks.
> commit 84393bfd731c435120dc1dda63432a70124821cb
> Author: Namhyung Kim <namhyung@gmail.com>
> Date: Wed Apr 6 11:20:50 2011 +0900
>
> blame: add --abbrev command line option and make it honor core.abbrev
>
> If user sets config.abbrev option, use it as if --abbrev was given. This
> is the default value and user can override different abbrev length by
> specifying the --abbrev=N command line option.
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
--
Regards,
Namhyung Kim
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-04-06 11:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-06 2:20 [PATCH v2 1/3] blame: add --abbrev command line option Namhyung Kim
2011-04-06 2:20 ` [PATCH v2 2/3] blame: honor core.abbrev Namhyung Kim
2011-04-06 2:20 ` [PATCH v2 3/3] Documentation: add --abbrev option to the man page of git blame Namhyung Kim
2011-04-06 2:46 ` [PATCH v2 1/3] blame: add --abbrev command line option Thiago Farina
2011-04-06 3:18 ` Junio C Hamano
2011-04-06 11:06 ` Namhyung Kim
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).