{"thread":{"id":"27006","subject":"[PATCH v2 1/3] blame: add --abbrev command line option","startedAt":"2011-04-06T02:20:50Z","lastAt":"2011-04-06T11:06:37Z","messageCount":6,"participants":["Namhyung Kim","Thiago Farina","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"165244","messageId":"1302056452-5387-1-git-send-email-namhyung@gmail.com","threadId":"27006","inReplyTo":null,"subject":"[PATCH v2 1/3] blame: add --abbrev command line option","fromName":"Namhyung Kim","fromEmail":"namhyung@gmail.com","sentAt":"2011-04-06T02:20:50Z","receivedAt":"2011-04-06T02:20:50Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"Signed-off-by: Namhyung Kim <namhyung@gmail.com>\n---\n builtin/blame.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex f6b03f7..253b480 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -41,6 +41,7 @@ static int reverse;\n static int blank_boundary;\n static int incremental;\n static int xdl_opts;\n+static int abbrev = 8;\n \n static enum date_mode blame_date_mode = DATE_ISO8601;\n static size_t blame_date_width;\n@@ -1670,7 +1671,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)\n \tcp = nth_line(sb, ent->lno);\n \tfor (cnt = 0; cnt < ent->num_lines; cnt++) {\n \t\tchar ch;\n-\t\tint length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;\n+\t\tint length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : abbrev;\n \n \t\tif (suspect->commit->object.flags & UNINTERESTING) {\n \t\t\tif (blank_boundary)\n@@ -2310,6 +2311,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_CALLBACK, 'C', NULL, &opt, \"score\", \"Find line copies within and across files\", PARSE_OPT_OPTARG, blame_copy_callback },\n \t\t{ OPTION_CALLBACK, 'M', NULL, &opt, \"score\", \"Find line movements within and across files\", PARSE_OPT_OPTARG, blame_move_callback },\n \t\tOPT_CALLBACK('L', NULL, &bottomtop, \"n,m\", \"Process only line range n,m, counting from 1\", blame_bottomtop_callback),\n+\t\tOPT__ABBREV(&abbrev),\n \t\tOPT_END()\n \t};\n \n-- \n1.7.4\n"},{"id":"165246","messageId":"1302056452-5387-2-git-send-email-namhyung@gmail.com","threadId":"27006","inReplyTo":"1302056452-5387-1-git-send-email-namhyung@gmail.com","subject":"[PATCH v2 2/3] blame: honor core.abbrev","fromName":"Namhyung Kim","fromEmail":"namhyung@gmail.com","sentAt":"2011-04-06T02:20:51Z","receivedAt":"2011-04-06T02:20:51Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"If user sets config.abbrev option, use it as if --abbrev was given.\nThis is the default value and user can override different abbrev\nlength by specifing --abbrev=N command line option.\n\nSigned-off-by: Namhyung Kim <namhyung@gmail.com>\n---\n builtin/blame.c |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 253b480..4639788 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -41,7 +41,7 @@ static int reverse;\n static int blank_boundary;\n static int incremental;\n static int xdl_opts;\n-static int abbrev = 8;\n+static int abbrev = -1;\n \n static enum date_mode blame_date_mode = DATE_ISO8601;\n static size_t blame_date_width;\n@@ -2347,6 +2347,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n parse_done:\n \targc = parse_options_end(&ctx);\n \n+\tif (abbrev == -1)\n+\t\tabbrev = default_abbrev;\n+\t/* one more abbrev length is needed for the boundary commit */\n+\tabbrev++;\n+\n \tif (revs_file && read_ancestry(revs_file))\n \t\tdie_errno(\"reading graft file '%s' failed\", revs_file);\n \n-- \n1.7.4\n"},{"id":"165245","messageId":"1302056452-5387-3-git-send-email-namhyung@gmail.com","threadId":"27006","inReplyTo":"1302056452-5387-1-git-send-email-namhyung@gmail.com","subject":"[PATCH v2 3/3] Documentation: add --abbrev option to the man page of git blame","fromName":"Namhyung Kim","fromEmail":"namhyung@gmail.com","sentAt":"2011-04-06T02:20:52Z","receivedAt":"2011-04-06T02:20:52Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"Signed-off-by: Namhyung Kim <namhyung@gmail.com>\n---\n Documentation/git-blame.txt |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt\nindex c4d1ff8..27ce6bd 100644\n--- a/Documentation/git-blame.txt\n+++ b/Documentation/git-blame.txt\n@@ -9,7 +9,7 @@ SYNOPSIS\n --------\n [verse]\n 'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental] [-L n,m]\n-\t    [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]\n+\t    [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>] [--abbrev=<n>]\n \t    [<rev> | --contents <file> | --reverse <rev>] [--] <file>\n \n DESCRIPTION\n@@ -73,6 +73,12 @@ include::blame-options.txt[]\n \tIgnore whitespace when comparing the parent's version and\n \tthe child's to find where the lines came from.\n \n+--abbrev=<n>::\n+\tInstead of using the default 7+1 hexadecimal digits as the\n+\tabbreviated object name, use <n>+1 digits. Note that git\n+\twill add 1 for the boundary commit to be distinguished (with\n+\ta caret at the beginning).\n+\n \n THE PORCELAIN FORMAT\n --------------------\n-- \n1.7.4\n"},{"id":"165247","messageId":"BANLkTim8bR1Z5sQCtVeqCJcCh_wuQxCvJQ@mail.gmail.com","threadId":"27006","inReplyTo":"1302056452-5387-1-git-send-email-namhyung@gmail.com","subject":"Re: [PATCH v2 1/3] blame: add --abbrev command line option","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2011-04-06T02:46:19Z","receivedAt":"2011-04-06T02:46:19Z","isPatch":true,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"On Tue, Apr 5, 2011 at 11:20 PM, Namhyung Kim <namhyung@gmail.com> wrote:\n> Signed-off-by: Namhyung Kim <namhyung@gmail.com>\n> ---\n>  builtin/blame.c |    4 +++-\n>  1 files changed, 3 insertions(+), 1 deletions(-)\n>\n> diff --git a/builtin/blame.c b/builtin/blame.c\n> index f6b03f7..253b480 100644\n> --- a/builtin/blame.c\n> +++ b/builtin/blame.c\n> @@ -41,6 +41,7 @@ static int reverse;\n>  static int blank_boundary;\n>  static int incremental;\n>  static int xdl_opts;\n> +static int abbrev = 8;\n>\n>  static enum date_mode blame_date_mode = DATE_ISO8601;\n>  static size_t blame_date_width;\n> @@ -1670,7 +1671,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)\n>        cp = nth_line(sb, ent->lno);\n>        for (cnt = 0; cnt < ent->num_lines; cnt++) {\n>                char ch;\n> -               int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;\n> +               int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : abbrev;\n\nShould this 40 be a constant?\n"},{"id":"165248","messageId":"7vy63ojced.fsf@alter.siamese.dyndns.org","threadId":"27006","inReplyTo":"1302056452-5387-1-git-send-email-namhyung@gmail.com","subject":"Re: [PATCH v2 1/3] blame: add --abbrev command line option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-06T03:18:18Z","receivedAt":"2011-04-06T03:18:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n\nAs the meaning of the option changes between 1/3 and 2/3, let's squash\nthese three patches into a single commit.  Here is what I've tentatively\nqueued.\n\ncommit 84393bfd731c435120dc1dda63432a70124821cb\nAuthor: Namhyung Kim <namhyung@gmail.com>\nDate:   Wed Apr 6 11:20:50 2011 +0900\n\n    blame: add --abbrev command line option and make it honor core.abbrev\n    \n    If user sets config.abbrev option, use it as if --abbrev was given.  This\n    is the default value and user can override different abbrev length by\n    specifying the --abbrev=N command line option.\n    \n    Signed-off-by: Namhyung Kim <namhyung@gmail.com>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"},{"id":"165260","messageId":"1302087997.1509.0.camel@leonhard","threadId":"27006","inReplyTo":"7vy63ojced.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 1/3] blame: add --abbrev command line option","fromName":"Namhyung Kim","fromEmail":"namhyung@gmail.com","sentAt":"2011-04-06T11:06:37Z","receivedAt":"2011-04-06T11:06:37Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"2011-04-05 (화), 20:18 -0700, Junio C Hamano:\n> Thanks.\n> \n> As the meaning of the option changes between 1/3 and 2/3, let's squash\n> these three patches into a single commit.  Here is what I've tentatively\n> queued.\n> \n\nGreat! Thanks.\n\n\n> commit 84393bfd731c435120dc1dda63432a70124821cb\n> Author: Namhyung Kim <namhyung@gmail.com>\n> Date:   Wed Apr 6 11:20:50 2011 +0900\n> \n>     blame: add --abbrev command line option and make it honor core.abbrev\n>     \n>     If user sets config.abbrev option, use it as if --abbrev was given.  This\n>     is the default value and user can override different abbrev length by\n>     specifying the --abbrev=N command line option.\n>     \n>     Signed-off-by: Namhyung Kim <namhyung@gmail.com>\n>     Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\n\n-- \nRegards,\nNamhyung Kim\n"}]}