{"thread":{"id":"27735","subject":"[PATCH] branch: honor core.abbrev","startedAt":"2011-06-30T16:02:42Z","lastAt":"2011-07-02T01:32:00Z","messageCount":8,"participants":["Namhyung Kim","Jonathan Nieder","Andreas Schwab","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"170711","messageId":"1309449762-10476-1-git-send-email-namhyung@gmail.com","threadId":"27735","inReplyTo":null,"subject":"[PATCH] branch: honor core.abbrev","fromName":"Namhyung Kim","fromEmail":"namhyung@gmail.com","sentAt":"2011-06-30T16:02:42Z","receivedAt":"2011-06-30T16:02:42Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"Honor 'core.abbrev' configuration unless user specifies the\nlength on command line. In order to do that, we need to set\n'abbrev' to DEFAULT_ABBREV after config and command line\nparsing done.\n\nSigned-off-by: Namhyung Kim <namhyung@gmail.com>\n---\n Documentation/git-branch.txt |    1 +\n builtin/branch.c             |    5 ++++-\n 2 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex c50f189..906cccc 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -114,6 +114,7 @@ OPTIONS\n --abbrev=<length>::\n \tAlter the sha1's minimum display length in the output listing.\n \tThe default value is 7.\n+\t(and can be overrided by the `core.abbrev` config option).\n \n --no-abbrev::\n \tDisplay the full sha1s in the output listing rather than abbreviating them.\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex d6ab93b..5a15022 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -613,7 +613,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int\n int cmd_branch(int argc, const char **argv, const char *prefix)\n {\n \tint delete = 0, rename = 0, force_create = 0;\n-\tint verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0;\n+\tint verbose = 0, abbrev = -1, detached = 0;\n \tint reflog = 0;\n \tenum branch_track track;\n \tint kinds = REF_LOCAL_BRANCH;\n@@ -696,6 +696,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \tif (!!delete + !!rename + !!force_create > 1)\n \t\tusage_with_options(builtin_branch_usage, options);\n \n+\tif (abbrev == -1)\n+\t\tabbrev = DEFAULT_ABBREV;\n+\n \tif (delete)\n \t\treturn delete_branches(argc, argv, delete > 1, kinds);\n \telse if (argc == 0)\n-- \n1.7.6\n"},{"id":"170718","messageId":"20110630181020.GA1128@elie","threadId":"27735","inReplyTo":"1309449762-10476-1-git-send-email-namhyung@gmail.com","subject":"Re: [PATCH] branch: honor core.abbrev","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-06-30T18:10:20Z","receivedAt":"2011-06-30T18:10:20Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Namhyung Kim wrote:\n\n> --- a/Documentation/git-branch.txt\n> +++ b/Documentation/git-branch.txt\n> @@ -114,6 +114,7 @@ OPTIONS\n>  --abbrev=<length>::\n>  \tAlter the sha1's minimum display length in the output listing.\n>  \tThe default value is 7.\n> +\t(and can be overrided by the `core.abbrev` config option).\n\nNitpicks: this would be clearer without the period after \"7\" and without\nthe parentheses around the following phrase.  s/overrided/overridden/.\n\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -613,7 +613,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int\n>  int cmd_branch(int argc, const char **argv, const char *prefix)\n>  {\n>  \tint delete = 0, rename = 0, force_create = 0;\n> -\tint verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0;\n> +\tint verbose = 0, abbrev = -1, detached = 0;\n\nYes.  (One meaningful \"c89 -pedantic\" warning down, several to go.)\n\nSome squashable tests follow.  Maybe they can be useful.  Thanks for\nfixing this.  \n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t3203-branch-output.sh |   29 +++++++++++++++++++++++++++++\n 1 files changed, 29 insertions(+), 0 deletions(-)\n\ndiff --git i/t/t3203-branch-output.sh w/t/t3203-branch-output.sh\nindex 6b7c118e..87333b49 100755\n--- i/t/t3203-branch-output.sh\n+++ w/t/t3203-branch-output.sh\n@@ -3,6 +3,17 @@\n test_description='git branch display tests'\n . ./test-lib.sh\n \n+minimum_line_length () {\n+\tawk '\n+\t\tBEGIN { minlen = 99 }\n+\t\t{\n+\t\t\tif (length($1) < minlen)\n+\t\t\t\tminlen = length($1)\n+\t\t}\n+\t\tEND { print minlen }\n+\t'\n+}\n+\n test_expect_success 'make commits' '\n \techo content >file &&\n \tgit add file &&\n@@ -66,6 +77,24 @@ test_expect_success 'git branch -v shows branch summaries' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'git branch -v --abbrev' '\n+\techo 10 >expect &&\n+\tgit branch -v --abbrev=10 >tmp &&\n+\tawk \"{print \\$(NF - 1)}\" <tmp >commitids &&\n+\tminimum_line_length <commitids >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'git branch -v respects [core] abbrev configuration' '\n+\tgit config core.abbrev 9 &&\n+\ttest_when_finished \"git config --unset core.abbrev\" &&\n+\techo 9 >expect &&\n+\tgit branch -v >tmp &&\n+\tawk \"{print \\$(NF - 1)}\" <tmp >commitids &&\n+\tminimum_line_length <commitids >actual &&\n+\ttest_cmp expect actual\n+'\n+\n cat >expect <<'EOF'\n * (no branch)\n   branch-one\n"},{"id":"170720","messageId":"m2pqlvmayd.fsf@igel.home","threadId":"27735","inReplyTo":"1309449762-10476-1-git-send-email-namhyung@gmail.com","subject":"Re: [PATCH] branch: honor core.abbrev","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-06-30T18:27:22Z","receivedAt":"2011-06-30T18:27:22Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Namhyung Kim <namhyung@gmail.com> writes:\n\n> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\n> index c50f189..906cccc 100644\n> --- a/Documentation/git-branch.txt\n> +++ b/Documentation/git-branch.txt\n> @@ -114,6 +114,7 @@ OPTIONS\n>  --abbrev=<length>::\n>  \tAlter the sha1's minimum display length in the output listing.\n>  \tThe default value is 7.\n> +\t(and can be overrided by the `core.abbrev` config option).\n\noverridden\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"170737","messageId":"1309500368-3729-1-git-send-email-namhyung@gmail.com","threadId":"27735","inReplyTo":"20110630181020.GA1128@elie","subject":"[PATCH v2] branch: honor core.abbrev","fromName":"Namhyung Kim","fromEmail":"namhyung@gmail.com","sentAt":"2011-07-01T06:06:08Z","receivedAt":"2011-07-01T06:06:08Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"Honor 'core.abbrev' configuration unless user specifies the\nlength on command line. In order to do that, we need to set\n'abbrev' to DEFAULT_ABBREV after config and command line\nparsing done.\n\nSigned-off-by: Namhyung Kim <namhyung@gmail.com>\n---\nSorry for my bad English and thanks for pointing this out. :)\n\n Documentation/git-branch.txt |    3 ++-\n builtin/branch.c             |    5 ++++-\n 2 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex c50f189..507b8d0 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -113,7 +113,8 @@ OPTIONS\n \n --abbrev=<length>::\n \tAlter the sha1's minimum display length in the output listing.\n-\tThe default value is 7.\n+\tThe default value is 7 and can be overridden by the `core.abbrev`\n+\tconfig option.\n \n --no-abbrev::\n \tDisplay the full sha1s in the output listing rather than abbreviating them.\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex d6ab93b..5a15022 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -613,7 +613,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int\n int cmd_branch(int argc, const char **argv, const char *prefix)\n {\n \tint delete = 0, rename = 0, force_create = 0;\n-\tint verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0;\n+\tint verbose = 0, abbrev = -1, detached = 0;\n \tint reflog = 0;\n \tenum branch_track track;\n \tint kinds = REF_LOCAL_BRANCH;\n@@ -696,6 +696,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \tif (!!delete + !!rename + !!force_create > 1)\n \t\tusage_with_options(builtin_branch_usage, options);\n \n+\tif (abbrev == -1)\n+\t\tabbrev = DEFAULT_ABBREV;\n+\n \tif (delete)\n \t\treturn delete_branches(argc, argv, delete > 1, kinds);\n \telse if (argc == 0)\n-- \n1.7.6\n"},{"id":"170738","messageId":"1309500640.1310.53.camel@leonhard","threadId":"27735","inReplyTo":"m2pqlvmayd.fsf@igel.home","subject":"Re: [PATCH] branch: honor core.abbrev","fromName":"Namhyung Kim","fromEmail":"namhyung@gmail.com","sentAt":"2011-07-01T06:10:40Z","receivedAt":"2011-07-01T06:10:40Z","isPatch":true,"sender":{"key":"namhyung@gmail.com","avatar":"https://avatars.githubusercontent.com/u/48503?v=4"},"body":"2011-06-30 (목), 20:27 +0200, Andreas Schwab:\n> Namhyung Kim <namhyung@gmail.com> writes:\n> \n> > diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\n> > index c50f189..906cccc 100644\n> > --- a/Documentation/git-branch.txt\n> > +++ b/Documentation/git-branch.txt\n> > @@ -114,6 +114,7 @@ OPTIONS\n> >  --abbrev=<length>::\n> >  \tAlter the sha1's minimum display length in the output listing.\n> >  \tThe default value is 7.\n> > +\t(and can be overrided by the `core.abbrev` config option).\n> \n> overridden\n> \n> Andreas.\n> \n\nFixed and resent.\n\nThanks.\n\n-- \nRegards,\nNamhyung Kim\n"},{"id":"170748","messageId":"7voc1doo8v.fsf@alter.siamese.dyndns.org","threadId":"27735","inReplyTo":"1309500368-3729-1-git-send-email-namhyung@gmail.com","subject":"Re: [PATCH v2] branch: honor core.abbrev","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-07-01T18:21:52Z","receivedAt":"2011-07-01T18:21:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Namhyung Kim <namhyung@gmail.com> writes:\n\n> Honor 'core.abbrev' configuration unless user specifies the\n> length on command line. In order to do that, we need to set\n\nIt is not clear from this description when \"git branch\" needs to even show\nabbreviated object name.  I'll retitle it and/or reword the description to\nhint that you are talking about \"branch -v\", but do you know of anything\nin \"git branch\" that may be affected by this change other than \"-v\" output?\n"},{"id":"170750","messageId":"20110701190558.GC8929@elie","threadId":"27735","inReplyTo":"7voc1doo8v.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] branch: honor core.abbrev","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-07-01T19:05:58Z","receivedAt":"2011-07-01T19:05:58Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> It is not clear from this description when \"git branch\" needs to even show\n> abbreviated object name.  I'll retitle it and/or reword the description to\n> hint that you are talking about \"branch -v\", but do you know of anything\n> in \"git branch\" that may be affected by this change other than \"-v\" output?\n\nI think it's just add_verbose_info.  \"git branch\" also uses\nDEFAULT_ABBREV in the message\n\n\tDeleted branch topic (was 980ab98c).\n\nbut that is not currently affected by the --abbrev option.\n"},{"id":"170761","messageId":"20110702013200.GA2374@elie","threadId":"27735","inReplyTo":"20110630181020.GA1128@elie","subject":"Re: [PATCH] branch: honor core.abbrev","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-07-02T01:32:00Z","receivedAt":"2011-07-02T01:32:00Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> Some squashable tests follow.  Maybe they can be useful.  Thanks for\n> fixing this.  \n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n>  t/t3203-branch-output.sh |   29 +++++++++++++++++++++++++++++\n>  1 files changed, 29 insertions(+), 0 deletions(-)\n\nAre these not wanted?  Or are there improvements needed before they\ncan be included?\n"}]}