{"thread":{"id":"29768","subject":"Incremental updates to What's cooking","startedAt":"2012-02-28T06:53:16Z","lastAt":"2012-03-27T18:44:26Z","messageCount":23,"participants":["Junio C Hamano","Zbigniew Jędrzejewski-Szmek","Jeff King","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"185591","messageId":"7vy5rn1mar.fsf@alter.siamese.dyndns.org","threadId":"29768","inReplyTo":null,"subject":"Incremental updates to What's cooking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-28T06:53:16Z","receivedAt":"2012-02-28T06:53:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"It is a bit too much to keep sending the full report every night, so I'll\nsend out some highlights since issue #09 of this month for tonight.\n\nShort term plans\n----------------\n\nWill merge to \"master\".\n + jb/required-filter                     02-17/02-26    #1\n + ph/cherry-pick-advice-refinement       02-22/02-26    #1\n + pj/completion-remote-set-url-branches  02-22/02-26    #2\n\nWill merge to \"next\"\n - cn/maint-branch-with-bad               02-27          #1\n - jk/symbolic-ref-short                  02-27          #1\n\nWill merge to \"next\", perhaps?\n - jn/gitweb-hilite-regions               02-26          #4\n - th/git-diffall                         02-27          #1\n\n\nNotable topics that may need more discussion\n--------------------------------------------\n\nI will not list the stalled topics here and harrass owners of them here.\n\n* zj/diff-stat-dyncol (2012-02-27) 11 commits\n - diff --stat: add config option to limit graph width\n - diff --stat: enable limiting of the graph part\n - diff --stat: add a test for output with COLUMNS=40\n - diff --stat: use a maximum of 5/8 for the filename part\n - merge --stat: use the full terminal width\n - log --stat: use the full terminal width\n - show --stat: use the full terminal width\n - diff --stat: use the full terminal width\n - diff --stat: tests for long filenames and big change counts\n - t4014: addtional format-patch test vectors\n - Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scaler\n\nI resurrected the additional tests for format-patch from an earlier round,\nas it illustrates the behaviour change brought by \"5/8 split\" very well.\n\n* nd/columns (2012-02-26) 11 commits\n - tag: add --column\n - column: support piping stdout to external git-column process\n - status: add --column\n - branch: add --column\n - help: reuse print_columns() for help -a\n - column: add column.ui for default column output settings\n - column: support columns with different widths\n - column: add columnar layout\n - Stop starting pager recursively\n - Add git-column and column mode parsing\n - column: add API to print items in columns\n\nComments by Ramsay on the parsing code seemed reasonable.\n\n* cb/fsck-squelch-dangling (2012-02-26) 1 commit\n - fsck: do not print dangling objects by default\n\nIntroduces \"fsck --dangling\" and removes the output for dangling objects\nfrom the default output.\n\nThe first patch to advance this topic should add --[no-]dangling option\nand update the documentation to illustrate its use.  On top of that, if we\nwere to change the default not to show the dangling objects, deprecation\npatches that span longer timeperiod need to be built, but the follow-on\npatches and the default change may not be necessary, given that the\ncommand is \"fsck\".\n\n* rs/no-no-no-parseopt (2012-02-26) 3 commits\n - parse-options: remove PARSE_OPT_NEGHELP\n - parse-options: allow positivation of options starting, with no-\n - test-parse-options: convert to OPT_BOOL()\n\nOptions that use PARSE_OPT_NEGHELP needed to word their help text in\na strange way, and this gets rid of the uses of them.\n\nI tend to agree with Peff that REVERSE_BOOL or NEGBIT based solution may\nbe more readable in the longer term. As the options that used the funny\nNEGHELP are limited, the difference between two approaches may not matter\ntoo much, but then that argues against fixing the funny help messages,\nso...\n"},{"id":"185703","messageId":"4F4DD5C1.60604@in.waw.pl","threadId":"29768","inReplyTo":"7vy5rn1mar.fsf@alter.siamese.dyndns.org","subject":"Re: Incremental updates to What's cooking","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-29T07:37:37Z","receivedAt":"2012-02-29T07:37:37Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 02/28/2012 07:53 AM, Junio C Hamano wrote:\n\n> * zj/diff-stat-dyncol (2012-02-27) 11 commits\n>   - diff --stat: add config option to limit graph width\n>   - diff --stat: enable limiting of the graph part\n>   - diff --stat: add a test for output with COLUMNS=40\n>   - diff --stat: use a maximum of 5/8 for the filename part\n>   - merge --stat: use the full terminal width\n>   - log --stat: use the full terminal width\n>   - show --stat: use the full terminal width\n>   - diff --stat: use the full terminal width\n>   - diff --stat: tests for long filenames and big change counts\n>   - t4014: addtional format-patch test vectors\n>   - Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scaler\n>\n> I resurrected the additional tests for format-patch from an earlier round,\n> as it illustrates the behaviour change brought by \"5/8 split\" very well.\nHi,\nthe resurrected tests are partly duplicated in 4052-stat-output.sh:\n\nt4014:\nok 75 - small change with long name gives more space to the name\nok 76 - a long name is given more room when the bar is short\nok 77 - format patch --stat-width=width works with long name        *\nok 78 - format patch --stat=...,name-width with long name           *\nok 79 - format patch --stat-name-width with long name               *\nok 81 - format patch graph part width                               *\nok 82 - format patch ignores COLUMNS                                *\nok 83 - format patch --stat=width with big change                   *\nok 84 - format patch --stat-width=width with big change             *\nok 85 - partition between long name and big change is more balanced\n\nt4052:\nok 3 - format-patch graph width defaults to 80 columns\nok 4 - format-patch --stat=width with long name\nok 5 - format-patch --stat-width=width with long name\nok 6 - format-patch --stat=...,name-width with long name\nok 7 - format-patch --stat-name-width with long name\nok 24 - format-patch ignores too many COLUMNS (big change)\nok 28 - format-patch ignores not enough COLUMNS (big change)\nok 29 - format-patch ignores statGraphWidth config\nok 36 - format-patch --stat=width with big change\nok 37 - format-patch --stat-width=width with big change\nok 38 - format-patch --stat-graph--width with big change\nok 49 - format-patch --stat=width with big change and long name\nok 53 - format-patch ignores COLUMNS (long filename)\n\nThe ones with * are duplicated exactly. They tests run very fast, but \nmaybe the duplicated ones should be culled.\n\nZbyszek\n"},{"id":"185709","messageId":"7vbooiuj6z.fsf@alter.siamese.dyndns.org","threadId":"29768","inReplyTo":"4F4DD5C1.60604@in.waw.pl","subject":"Re: Incremental updates to What's cooking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-29T08:39:48Z","receivedAt":"2012-02-29T08:39:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n\n> On 02/28/2012 07:53 AM, Junio C Hamano wrote:\n>\n>> * zj/diff-stat-dyncol (2012-02-27) 11 commits\n>>   - diff --stat: add config option to limit graph width\n>>   - diff --stat: enable limiting of the graph part\n>>   - diff --stat: add a test for output with COLUMNS=40\n>>   - diff --stat: use a maximum of 5/8 for the filename part\n>>   - merge --stat: use the full terminal width\n>>   - log --stat: use the full terminal width\n>>   - show --stat: use the full terminal width\n>>   - diff --stat: use the full terminal width\n>>   - diff --stat: tests for long filenames and big change counts\n>>   - t4014: addtional format-patch test vectors\n>>   - Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scaler\n>>\n>> I resurrected the additional tests for format-patch from an earlier round,\n>> as it illustrates the behaviour change brought by \"5/8 split\" very well.\n> Hi,\n> the resurrected tests are partly duplicated in 4052-stat-output.sh:\n>\n> t4014:\n> ok 75 - small change with long name gives more space to the name\n> ok 76 - a long name is given more room when the bar is short\n> ok 77 - format patch --stat-width=width works with long name        *\n> ok 78 - format patch --stat=...,name-width with long name           *\n> ok 79 - format patch --stat-name-width with long name               *\n> ok 81 - format patch graph part width                               *\n> ok 82 - format patch ignores COLUMNS                                *\n> ok 83 - format patch --stat=width with big change                   *\n> ok 84 - format patch --stat-width=width with big change             *\n> ok 85 - partition between long name and big change is more balanced\n>\n> t4052:\n> ok 3 - format-patch graph width defaults to 80 columns\n> ok 4 - format-patch --stat=width with long name\n> ok 5 - format-patch --stat-width=width with long name\n> ok 6 - format-patch --stat=...,name-width with long name\n> ok 7 - format-patch --stat-name-width with long name\n> ok 24 - format-patch ignores too many COLUMNS (big change)\n> ok 28 - format-patch ignores not enough COLUMNS (big change)\n> ok 29 - format-patch ignores statGraphWidth config\n> ok 36 - format-patch --stat=width with big change\n> ok 37 - format-patch --stat-width=width with big change\n> ok 38 - format-patch --stat-graph--width with big change\n> ok 49 - format-patch --stat=width with big change and long name\n> ok 53 - format-patch ignores COLUMNS (long filename)\n>\n> The ones with * are duplicated exactly. They tests run very fast, but\n> maybe the duplicated ones should be culled.\n\nYeah, probably we should de-dup them.\n\nCompare the behaviour change shown for t4052 and for t4014 by 119c07bf.\nWhich one more obviously show the effect of the code change to allow the\nreader judge if the behaviour change is going in a good direction?\n\nThe style used in t4052 only changes expect_failure to expect_success, and\nthe reader has to accept the judgement of the person who wrote the test\nvector and declared \"this is the _right_ output!\".  The way t4014, taken\nfrom your earlier round, shows the behaviour change shows how the\nexpectation changes from the old behaviour to the new one, and the reader\ncan see and decide which one is giving a better output.\n\nActually, the whole reason I didn't notice duplicates in 4052 was because\nof the above X-<.\n\nIf we remove duplicates, will 4052 become empty?  It would be really nice\nif we do not have to add a new test script for this series, and instead\nadd necessary new tests to existing scripts.\n"},{"id":"185722","messageId":"4F4E2D32.9030209@in.waw.pl","threadId":"29768","inReplyTo":"7vbooiuj6z.fsf@alter.siamese.dyndns.org","subject":"Re: Incremental updates to What's cooking","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-29T13:50:42Z","receivedAt":"2012-02-29T13:50:42Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 02/29/2012 09:39 AM, Junio C Hamano wrote:\n> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:\n>\n>> On 02/28/2012 07:53 AM, Junio C Hamano wrote:\n>>\n>>> * zj/diff-stat-dyncol (2012-02-27) 11 commits\n>>>    - diff --stat: add config option to limit graph width\n>>>    - diff --stat: enable limiting of the graph part\n>>>    - diff --stat: add a test for output with COLUMNS=40\n>>>    - diff --stat: use a maximum of 5/8 for the filename part\n>>>    - merge --stat: use the full terminal width\n>>>    - log --stat: use the full terminal width\n>>>    - show --stat: use the full terminal width\n>>>    - diff --stat: use the full terminal width\n>>>    - diff --stat: tests for long filenames and big change counts\n>>>    - t4014: addtional format-patch test vectors\n>>>    - Merge branches zj/decimal-width, zj/term-columns and jc/diff-stat-scaler\n>>>\n>>> I resurrected the additional tests for format-patch from an earlier round,\n>>> as it illustrates the behaviour change brought by \"5/8 split\" very well.\n>> Hi,\n>> the resurrected tests are partly duplicated in 4052-stat-output.sh:\n>>\n>> t4014:\n>> ok 75 - small change with long name gives more space to the name\n>> ok 76 - a long name is given more room when the bar is short\n>> ok 77 - format patch --stat-width=width works with long name        *\n>> ok 78 - format patch --stat=...,name-width with long name           *\n>> ok 79 - format patch --stat-name-width with long name               *\n>> ok 81 - format patch graph part width                               *\n>> ok 82 - format patch ignores COLUMNS                                *\n>> ok 83 - format patch --stat=width with big change                   *\n>> ok 84 - format patch --stat-width=width with big change             *\n>> ok 85 - partition between long name and big change is more balanced\n>>\n>> t4052:\n>> ok 3 - format-patch graph width defaults to 80 columns\n>> ok 4 - format-patch --stat=width with long name\n>> ok 5 - format-patch --stat-width=width with long name\n>> ok 6 - format-patch --stat=...,name-width with long name\n>> ok 7 - format-patch --stat-name-width with long name\n>> ok 24 - format-patch ignores too many COLUMNS (big change)\n>> ok 28 - format-patch ignores not enough COLUMNS (big change)\n>> ok 29 - format-patch ignores statGraphWidth config\n>> ok 36 - format-patch --stat=width with big change\n>> ok 37 - format-patch --stat-width=width with big change\n>> ok 38 - format-patch --stat-graph--width with big change\n>> ok 49 - format-patch --stat=width with big change and long name\n>> ok 53 - format-patch ignores COLUMNS (long filename)\n>>\n>> The ones with * are duplicated exactly. They tests run very fast, but\n>> maybe the duplicated ones should be culled.\n>\n> Yeah, probably we should de-dup them.\n>\n> Compare the behaviour change shown for t4052 and for t4014 by 119c07bf.\n> Which one more obviously show the effect of the code change to allow the\n> reader judge if the behaviour change is going in a good direction?\nt4014 it seems, but mostly because of more descriptive test names.\nBut this is only true for the ones without *, I think. So the ones with \n* can be deleted without losing this advantage.\n\nThe ones with * are very similar in t4014 and t4052.\n\n> The style used in t4052 only changes expect_failure to expect_success, and\n> the reader has to accept the judgement of the person who wrote the test\n> vector and declared \"this is the _right_ output!\".  The way t4014, taken\n> from your earlier round, shows the behaviour change shows how the\n> expectation changes from the old behaviour to the new one, and the reader\n> can see and decide which one is giving a better output.\n>\n> Actually, the whole reason I didn't notice duplicates in 4052 was because\n> of the above X-<.\n>\n> If we remove duplicates, will 4052 become empty?  It would be really nice\n> if we do not have to add a new test script for this series, and instead\n> add necessary new tests to existing scripts.\nt4052 tests show, log, merge, diff and format-patch with basically the \nsame commands. Separating the tests into different files would require \nduplicating a lot of setup code. OTOH, t4014 is only about format-patch, \nso the other ones don't fit. I thought it would be better to create a \nnew file.\n\n-\nZbyszek\n"},{"id":"185736","messageId":"7v1updtp57.fsf@alter.siamese.dyndns.org","threadId":"29768","inReplyTo":"4F4E2D32.9030209@in.waw.pl","subject":"Re: Incremental updates to What's cooking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-29T19:28:52Z","receivedAt":"2012-02-29T19:28:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n\n> t4052 tests show, log, merge, diff and format-patch with basically the\n> same commands. Separating the tests into different files would require\n> duplicating a lot of setup code. OTOH, t4014 is only about\n> format-patch, so the other ones don't fit. I thought it would be\n> better to create a new file.\n\nOK, then perhaps we want to move the versions of duplicated one them from\n4014 to 4052?\n\nThanks.\n"},{"id":"185740","messageId":"4F4E8846.6030203@in.waw.pl","threadId":"29768","inReplyTo":"7v1updtp57.fsf@alter.siamese.dyndns.org","subject":"Re: Incremental updates to What's cooking","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-29T20:19:18Z","receivedAt":"2012-02-29T20:19:18Z","isPatch":false,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 02/29/2012 08:28 PM, Junio C Hamano wrote:\n> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:\n>\n>> t4052 tests show, log, merge, diff and format-patch with basically the\n>> same commands. Separating the tests into different files would require\n>> duplicating a lot of setup code. OTOH, t4014 is only about\n>> format-patch, so the other ones don't fit. I thought it would be\n>> better to create a new file.\n>\n> OK, then perhaps we want to move the versions of duplicated one them from\n> 4014 to 4052?\nDo you mean move a version of non-duplicated ones from t4014 to t4052 \nand remove the duplicated ones?\n\nZbyszek\n"},{"id":"185743","messageId":"7vfwdts6wj.fsf@alter.siamese.dyndns.org","threadId":"29768","inReplyTo":"4F4E8846.6030203@in.waw.pl","subject":"Re: Incremental updates to What's cooking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-29T20:48:12Z","receivedAt":"2012-02-29T20:48:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n\n> Do you mean move a version of non-duplicated ones from t4014 to t4052\n> and remove the duplicated ones?\n\nErr, non-duplicated ones do not have anything to do with your series, no?\nThey are good copies you inherited from people who touched the file before\nyou, and we can leave the file in the state before this series.\n\nAmong the ones added to t4014, there are ones that have moral equivalent\nin t4052.  These in t4052 are however less nice.  So I was suggesting to\nreplace these less nice ones in t4052 with their equivalents in t4014.\nWith such an update to t4052, the ones in t4014 that are duplicates in the\ntoday's code can be removed, as we would have identical copies of them in\nt4052.\n"},{"id":"185806","messageId":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"7vfwdts6wj.fsf@alter.siamese.dyndns.org","subject":"[PATCH v7a 1/9] diff --stat: tests for long filenames and big change counts","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:38Z","receivedAt":"2012-03-01T12:26:38Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"From: Junio C Hamano <gitster@pobox.com>\n\nIn preparation for updates to the \"diff --stat\" that updates the logic\nto split the allotted columns into the name part and the graph part to\nmake the output more readable, add a handful of tests to document the\ncorner case behaviour in which long filenames and big changes are shown.\n\nWhen a pathname is so long that it cannot fit on the column, the current\ncode truncates it to make sure that the graph part has enough room to show\na meaningful graph.  If the actual change is small (e.g. only one line\nchanged), this results in the final output that is shorter than the width\nwe aim for.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\nv7a:\n\nDe-decuplicate new tests added in t4014 and t4052. Test descriptions\nare taken from t4014, but the tests are all added in t4052.\n\nThis patch is a merge of 't4014: addtional format-patch test vectors'\nfrom Junio C Hamano and v7 of my 'diff --stat: tests for long filenames\nand big change counts'.\n\nThe rest of the series is only updated to apply cleanly after the changes\nto tests.\n\n[This patch series does not include the additional patches to minimize\nthe number of columns used for the change count number.]\n\n t/t4052-stat-output.sh |  182 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 182 insertions(+)\n create mode 100755 t/t4052-stat-output.sh\n\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nnew file mode 100755\nindex 0000000..f766c47\n--- /dev/null\n+++ b/t/t4052-stat-output.sh\n@@ -0,0 +1,182 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2012 Zbigniew Jędrzejewski-Szmek\n+#\n+\n+test_description='test --stat output of various commands'\n+\n+. ./test-lib.sh\n+. \"$TEST_DIRECTORY\"/lib-terminal.sh\n+\n+# 120 character name\n+name=aaaaaaaaaa\n+name=$name$name$name$name$name$name$name$name$name$name$name$name\n+test_expect_success 'preparation' '\n+\t>\"$name\" &&\n+\tgit add \"$name\" &&\n+\tgit commit -m message &&\n+\techo a >\"$name\" &&\n+\tgit commit -m message \"$name\"\n+'\n+\n+while read cmd args\n+do\n+\tcat >expect <<-'EOF'\n+\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+\tEOF\n+\ttest_expect_success \"$cmd: a short graph bar does not extend to the full width\" '\n+\t\tgit $cmd $args >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+\n+\tcat >expect <<-'EOF'\n+\t ...aaaaaaaaaaaaaaaaaaaaaa |    1 +\n+\tEOF\n+\ttest_expect_success \"$cmd --stat=width: name is chopped to leave room to the right of a short bar\" '\n+\t\tgit $cmd $args --stat=40 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+\n+\ttest_expect_success \"$cmd --stat-width=width with long name\" '\n+\t\tgit $cmd $args --stat-width=40 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+\n+\tcat >expect <<-'EOF'\n+\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+\tEOF\n+\ttest_expect_success \"$cmd --stat=...,name-width with long name\" '\n+\t\tgit $cmd $args --stat=60,30 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+\n+\ttest_expect_success \"$cmd --stat-name-width with long name\" '\n+\t\tgit $cmd $args --stat-name-width=30 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+done <<\\EOF\n+format-patch -1 --stdout\n+diff HEAD^ HEAD --stat\n+show --stat\n+log -1 --stat\n+EOF\n+\n+\n+test_expect_success 'preparation for big change tests' '\n+\t>abcd &&\n+\tgit add abcd &&\n+\tgit commit -m message &&\n+\ti=0 &&\n+\twhile test $i -lt 1000\n+\tdo\n+\t\techo $i && i=$(($i + 1))\n+\tdone >abcd &&\n+\tgit commit -m message abcd\n+'\n+\n+cat >expect80 <<'EOF'\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+EOF\n+\n+while read verb expect cmd args\n+do\n+\ttest_expect_success \"$cmd $verb COLUMNS (big change)\" '\n+\t\tCOLUMNS=200 git $cmd $args >output\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp \"$expect\" actual\n+\t'\n+done <<\\EOF\n+ignores expect80 format-patch -1 --stdout\n+ignores expect80 diff HEAD^ HEAD --stat\n+ignores expect80 show --stat\n+ignores expect80 log -1 --stat\n+EOF\n+\n+cat >expect <<'EOF'\n+ abcd | 1000 ++++++++++++++++++++++++++\n+EOF\n+while read cmd args\n+do\n+\ttest_expect_success \"$cmd --stat=width with big change\" '\n+\t\tgit $cmd $args --stat=40 >output\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+\n+\ttest_expect_success \"$cmd --stat-width=width with big change\" '\n+\t\tgit $cmd $args --stat-width=40 >output\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+done <<\\EOF\n+format-patch -1 --stdout\n+diff HEAD^ HEAD --stat\n+show --stat\n+log -1 --stat\n+EOF\n+\n+test_expect_success 'preparation for long filename tests' '\n+\tcp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&\n+\tgit add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&\n+\tgit commit -m message\n+'\n+\n+cat >expect <<'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++\n+EOF\n+while read cmd args\n+do\n+\ttest_expect_success \"$cmd --stat=width with big change and long name favors name part\" '\n+\t\tgit $cmd $args --stat-width=60 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n+done <<\\EOF\n+format-patch -1 --stdout\n+diff HEAD^ HEAD --stat\n+show --stat\n+log -1 --stat\n+EOF\n+\n+cat >expect80 <<'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++\n+EOF\n+while read verb expect cmd args\n+do\n+\ttest_expect_success \"$cmd $verb COLUMNS (long filename)\" '\n+\t\tCOLUMNS=200 git $cmd $args >output\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp \"$expect\" actual\n+\t'\n+done <<\\EOF\n+ignores expect80 format-patch -1 --stdout\n+ignores expect80 diff HEAD^ HEAD --stat\n+ignores expect80 show --stat\n+ignores expect80 log -1 --stat\n+EOF\n+\n+cat >expect <<'EOF'\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+EOF\n+test_expect_success 'merge --stat ignores COLUMNS (big change)' '\n+\tgit checkout -b branch HEAD^^ &&\n+\tCOLUMNS=100 git merge --stat --no-ff master^ >output &&\n+\tgrep \" | \" output >actual\n+\ttest_cmp expect actual\n+'\n+\n+cat >expect <<'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++\n+EOF\n+test_expect_success 'merge --stat ignores COLUMNS (long filename)' '\n+\tCOLUMNS=100 git merge --stat --no-ff master >output &&\n+\tgrep \" | \" output >actual\n+\ttest_cmp expect actual\n+'\n+\n+test_done\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185807","messageId":"1330604806-30288-2-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 2/9] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:39Z","receivedAt":"2012-03-01T12:26:39Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Default to the real terminal width for diff --stat output, instead\nof the hard-coded 80 columns.\n\nSome projects (especially in Java), have long filename paths, with\nnested directories or long individual filenames. When files are\nrenamed, the filename part in stat output can be almost useless. If\nthe middle part between { and } is long (because the file was moved to\na completely different directory), then most of the path would be\ntruncated.\n\nIt makes sense to detect and use the full terminal width and display\nfull filenames if possible.\n\nThe are commands like diff, show, and log, which can adapt the output\nto the terminal width. There are also commands like format-patch,\nwhose output should be independent of the terminal width. Since it is\nsafer to use the 80-column default, the real terminal width is only\nused if requested by the calling code by setting diffopts.stat_width=-1.\nNormally this value is 0, and can be set by the user only to a\nnon-negative value, so -1 is safe to use internally.\n\nThis patch only changes the diff builtin to use the full terminal width.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/diff.c         |    3 +++\n diff.c                 |    5 ++++-\n t/t4052-stat-output.sh |   11 +++++++++--\n 3 files changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 387afa7..81b6bae 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -285,6 +285,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \t/* Otherwise, we are doing the usual \"git\" diff */\n \trev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;\n \n+\t/* Scale to real terminal size */\n+\trev.diffopt.stat_width = -1;\n+\n \t/* Default to let external and textconv be used */\n \tDIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);\n \tDIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);\ndiff --git a/diff.c b/diff.c\nindex e0590a3..7478277 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1343,7 +1343,10 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\tline_prefix = msg->buf;\n \t}\n \n-\twidth = options->stat_width ? options->stat_width : 80;\n+\tif (options->stat_width == -1)\n+\t\twidth = term_columns();\n+\telse\n+\t\twidth = options->stat_width ? options->stat_width : 80;\n \tname_width = options->stat_name_width ? options->stat_name_width : 50;\n \tcount = options->stat_count ? options->stat_count : data->nr;\n \ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex f766c47..29c06e5 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -83,6 +83,10 @@ cat >expect80 <<'EOF'\n  abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n EOF\n \n+cat >expect200 <<'EOF'\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+EOF\n+\n while read verb expect cmd args\n do\n \ttest_expect_success \"$cmd $verb COLUMNS (big change)\" '\n@@ -92,7 +96,7 @@ do\n \t'\n done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n-ignores expect80 diff HEAD^ HEAD --stat\n+respects expect200 diff HEAD^ HEAD --stat\n ignores expect80 show --stat\n ignores expect80 log -1 --stat\n EOF\n@@ -146,6 +150,9 @@ EOF\n cat >expect80 <<'EOF'\n  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++\n EOF\n+cat >expect200 <<'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+EOF\n while read verb expect cmd args\n do\n \ttest_expect_success \"$cmd $verb COLUMNS (long filename)\" '\n@@ -155,7 +162,7 @@ do\n \t'\n done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n-ignores expect80 diff HEAD^ HEAD --stat\n+respects expect200 diff HEAD^ HEAD --stat\n ignores expect80 show --stat\n ignores expect80 log -1 --stat\n EOF\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185809","messageId":"1330604806-30288-3-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 3/9] show --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:40Z","receivedAt":"2012-03-01T12:26:40Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Make show --stat behave like diff --stat and use the full terminal\nwidth.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/log.c          |    2 ++\n t/t4052-stat-output.sh |    4 ++--\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 7d1f6f8..d37ae26 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -447,6 +447,8 @@ int cmd_show(int argc, const char **argv, const char *prefix)\n \trev.diff = 1;\n \trev.always_show_header = 1;\n \trev.no_walk = 1;\n+\trev.diffopt.stat_width = -1; \t/* Scale to real terminal size */\n+\n \tmemset(&opt, 0, sizeof(opt));\n \topt.def = \"HEAD\";\n \topt.tweak = show_rev_tweak_rev;\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 29c06e5..56d3899 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -97,7 +97,7 @@ do\n done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n respects expect200 diff HEAD^ HEAD --stat\n-ignores expect80 show --stat\n+respects expect200 show --stat\n ignores expect80 log -1 --stat\n EOF\n \n@@ -163,7 +163,7 @@ do\n done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n respects expect200 diff HEAD^ HEAD --stat\n-ignores expect80 show --stat\n+respects expect200 show --stat\n ignores expect80 log -1 --stat\n EOF\n \n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185810","messageId":"1330604806-30288-4-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 4/9] log --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:41Z","receivedAt":"2012-03-01T12:26:41Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Make log --stat behave like diff --stat and use the full terminal\nwidth.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/log.c          |    1 +\n t/t4052-stat-output.sh |    4 ++--\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex d37ae26..075a427 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -77,6 +77,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)\n \t\tget_commit_format(fmt_pretty, rev);\n \trev->verbose_header = 1;\n \tDIFF_OPT_SET(&rev->diffopt, RECURSIVE);\n+\trev->diffopt.stat_width = -1; /* use full terminal width */\n \trev->abbrev_commit = default_abbrev_commit;\n \trev->show_root_diff = default_show_root;\n \trev->subject_prefix = fmt_patch_subject_prefix;\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 56d3899..f81d427 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -98,7 +98,7 @@ done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n respects expect200 diff HEAD^ HEAD --stat\n respects expect200 show --stat\n-ignores expect80 log -1 --stat\n+respects expect200 log -1 --stat\n EOF\n \n cat >expect <<'EOF'\n@@ -164,7 +164,7 @@ done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n respects expect200 diff HEAD^ HEAD --stat\n respects expect200 show --stat\n-ignores expect80 log -1 --stat\n+respects expect200 log -1 --stat\n EOF\n \n cat >expect <<'EOF'\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185811","messageId":"1330604806-30288-5-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 5/9] merge --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:42Z","receivedAt":"2012-03-01T12:26:42Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Make merge --stat behave like diff --stat and use the full terminal\nwidth.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/merge.c        |    1 +\n t/t4052-stat-output.sh |    8 ++++----\n 2 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex b4fbc60..b1cd90c 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -399,6 +399,7 @@ static void finish(struct commit *head_commit,\n \tif (new_head && show_diffstat) {\n \t\tstruct diff_options opts;\n \t\tdiff_setup(&opts);\n+\t\topts.stat_width = -1; /* use full terminal width */\n \t\topts.output_format |=\n \t\t\tDIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;\n \t\topts.detect_rename = DIFF_DETECT_RENAME;\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex f81d427..954c16f 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -168,9 +168,9 @@ respects expect200 log -1 --stat\n EOF\n \n cat >expect <<'EOF'\n- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n EOF\n-test_expect_success 'merge --stat ignores COLUMNS (big change)' '\n+test_expect_success 'merge --stat respects COLUMNS (big change)' '\n \tgit checkout -b branch HEAD^^ &&\n \tCOLUMNS=100 git merge --stat --no-ff master^ >output &&\n \tgrep \" | \" output >actual\n@@ -178,9 +178,9 @@ test_expect_success 'merge --stat ignores COLUMNS (big change)' '\n '\n \n cat >expect <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++\n EOF\n-test_expect_success 'merge --stat ignores COLUMNS (long filename)' '\n+test_expect_success 'merge --stat respects COLUMNS (long filename)' '\n \tCOLUMNS=100 git merge --stat --no-ff master >output &&\n \tgrep \" | \" output >actual\n \ttest_cmp expect actual\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185812","messageId":"1330604806-30288-6-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 6/9] diff --stat: use a maximum of 5/8 for the filename part","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:43Z","receivedAt":"2012-03-01T12:26:43Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"The way that available columns are divided between the filename part\nand the graph part is modified to use as many columns as necessary for\nthe filenames and the rest for the graph.\n\nIf there isn't enough columns to print both the filename and the\ngraph, at least 5/8 of available space is devoted to filenames. On a\nstandard 80 column terminal, or if not connected to a terminal and\nusing the default of 80 columns, this gives the same partition as\nbefore.\n\nThe effect of this change is visible in the patch to the test vector\nin t4014; with a small change with long filename, it stops truncating\nthe name part too short, and also allocates a bit more columns to the\ngraph for larger changes.  t4052 shows a similar change.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/diff-options.txt |   14 ++++---\n diff.c                         |   90 ++++++++++++++++++++++++++--------------\n t/t4052-stat-output.sh         |   16 +++----\n 3 files changed, 76 insertions(+), 44 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 9f7cba2..6b9408f 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -53,13 +53,15 @@ endif::git-format-patch[]\n \tGenerate a diff using the \"patience diff\" algorithm.\n \n --stat[=<width>[,<name-width>[,<count>]]]::\n-\tGenerate a diffstat.  You can override the default\n-\toutput width for 80-column terminal by `--stat=<width>`.\n-\tThe width of the filename part can be controlled by\n-\tgiving another width to it separated by a comma.\n+\tGenerate a diffstat. By default, as much space as necessary\n+\twill be used for the filename part, and the rest for\n+\tthe graph part. Maximum width defaults to terminal width,\n+\tor 80 columns if not connected to a terminal, and can be\n+\toverriden by `<width>`. The width of the filename part can be\n+\tlimited by giving another width `<name-width>` after a comma.\n \tBy giving a third parameter `<count>`, you can limit the\n-\toutput to the first `<count>` lines, followed by\n-\t`...` if there are more.\n+\toutput to the first `<count>` lines, followed by `...` if\n+\tthere are more.\n +\n These parameters can also be set individually with `--stat-width=<width>`,\n `--stat-name-width=<name-width>` and `--stat-count=<count>`.\ndiff --git a/diff.c b/diff.c\nindex 7478277..1656310 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1329,7 +1329,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \tint i, len, add, del, adds = 0, dels = 0;\n \tuintmax_t max_change = 0, max_len = 0;\n \tint total_files = data->nr;\n-\tint width, name_width, count;\n+\tint width, name_width, graph_width, number_width = 4, count;\n \tconst char *reset, *add_c, *del_c;\n \tconst char *line_prefix = \"\";\n \tint extra_shown = 0;\n@@ -1343,28 +1343,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\tline_prefix = msg->buf;\n \t}\n \n-\tif (options->stat_width == -1)\n-\t\twidth = term_columns();\n-\telse\n-\t\twidth = options->stat_width ? options->stat_width : 80;\n-\tname_width = options->stat_name_width ? options->stat_name_width : 50;\n \tcount = options->stat_count ? options->stat_count : data->nr;\n \n-\t/* Sanity: give at least 5 columns to the graph,\n-\t * but leave at least 10 columns for the name.\n-\t */\n-\tif (width < 25)\n-\t\twidth = 25;\n-\tif (name_width < 10)\n-\t\tname_width = 10;\n-\telse if (width < name_width + 15)\n-\t\tname_width = width - 15;\n-\n-\t/* Find the longest filename and max number of changes */\n \treset = diff_get_color_opt(options, DIFF_RESET);\n \tadd_c = diff_get_color_opt(options, DIFF_FILE_NEW);\n \tdel_c = diff_get_color_opt(options, DIFF_FILE_OLD);\n \n+\t/*\n+\t * Find the longest filename and max number of changes\n+\t */\n \tfor (i = 0; (i < count) && (i < data->nr); i++) {\n \t\tstruct diffstat_file *file = data->files[i];\n \t\tuintmax_t change = file->added + file->deleted;\n@@ -1385,19 +1372,62 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t}\n \tcount = i; /* min(count, data->nr) */\n \n-\t/* Compute the width of the graph part;\n-\t * 10 is for one blank at the beginning of the line plus\n-\t * \" | count \" between the name and the graph.\n+\t/*\n+\t * We have width = stat_width or term_columns() columns total.\n+\t * We want a maximum of min(max_len, stat_name_width) for the name part.\n+\t * We also need 1 for \" \" and 4 + decimal_width(max_change)\n+\t * for \" | NNNN \" and one the empty column at the end, altogether\n+\t * 6 + decimal_width(max_change).\n+\t *\n+\t * If there's not enough space, we will use the smaller of\n+\t * stat_name_width (if set) and 5/8*width for the filename,\n+\t * and the rest for constant elements + graph part.\n+\t * (5/8 gives 50 for filename and 30 for the constant parts + graph\n+\t * for the standard terminal size).\n \t *\n-\t * From here on, name_width is the width of the name area,\n-\t * and width is the width of the graph area.\n+\t * In other words: stat_width limits the maximum width, and\n+\t * stat_name_width fixes the maximum width of the filename,\n+\t * and is also used to divide available columns if there\n+\t * aren't enough.\n \t */\n-\tname_width = (name_width < max_len) ? name_width : max_len;\n-\tif (width < (name_width + 10) + max_change)\n-\t\twidth = width - (name_width + 10);\n+\n+\tif (options->stat_width == -1)\n+\t\twidth = term_columns();\n \telse\n-\t\twidth = max_change;\n+\t\twidth = options->stat_width ? options->stat_width : 80;\n \n+\t/*\n+\t * Guarantee 3/8*16==6 for the graph part\n+\t * and 5/8*16==10 for the filename part\n+\t */\n+\tif (width < 16 + 6 + number_width)\n+\t\twidth = 16 + 6 + number_width;\n+\n+\t/*\n+\t * First assign sizes that are wanted, ignoring available width.\n+\t */\n+\tgraph_width = max_change;\n+\tname_width = (options->stat_name_width > 0 &&\n+\t\t      options->stat_name_width < max_len) ?\n+\t\toptions->stat_name_width : max_len;\n+\n+\t/*\n+\t * Adjust adjustable widths not to exceed maximum width\n+\t */\n+\tif (name_width + number_width + 6 + graph_width > width) {\n+\t\tif (graph_width > width * 3/8 - number_width - 6)\n+\t\t\tgraph_width = width * 3/8 - number_width - 6;\n+\t\tif (name_width > width - number_width - 6 - graph_width)\n+\t\t\tname_width = width - number_width - 6 - graph_width;\n+\t\telse\n+\t\t\tgraph_width = width - number_width - 6 - name_width;\n+\t}\n+\n+\t/*\n+\t * From here name_width is the width of the name area,\n+\t * and graph_width is the width of the graph area.\n+\t * max_change is used to scale graph properly.\n+\t */\n \tfor (i = 0; i < count; i++) {\n \t\tconst char *prefix = \"\";\n \t\tchar *name = data->files[i]->print_name;\n@@ -1453,18 +1483,18 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\tadds += add;\n \t\tdels += del;\n \n-\t\tif (width <= max_change) {\n+\t\tif (graph_width <= max_change) {\n \t\t\tint total = add + del;\n \n-\t\t\ttotal = scale_linear(add + del, width, max_change);\n+\t\t\ttotal = scale_linear(add + del, graph_width, max_change);\n \t\t\tif (total < 2 && add && del)\n \t\t\t\t/* width >= 2 due to the sanity check */\n \t\t\t\ttotal = 2;\n \t\t\tif (add < del) {\n-\t\t\t\tadd = scale_linear(add, width, max_change);\n+\t\t\t\tadd = scale_linear(add, graph_width, max_change);\n \t\t\t\tdel = total - add;\n \t\t\t} else {\n-\t\t\t\tdel = scale_linear(del, width, max_change);\n+\t\t\t\tdel = scale_linear(del, graph_width, max_change);\n \t\t\t\tadd = total - del;\n \t\t\t}\n \t\t}\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 954c16f..d0ed0dc 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -22,18 +22,18 @@ test_expect_success 'preparation' '\n while read cmd args\n do\n \tcat >expect <<-'EOF'\n-\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+\t ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n \tEOF\n-\ttest_expect_success \"$cmd: a short graph bar does not extend to the full width\" '\n+\ttest_expect_success \"$cmd: small change with long name gives more space to the name\" '\n \t\tgit $cmd $args >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect actual\n \t'\n \n \tcat >expect <<-'EOF'\n-\t ...aaaaaaaaaaaaaaaaaaaaaa |    1 +\n+\t ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n \tEOF\n-\ttest_expect_success \"$cmd --stat=width: name is chopped to leave room to the right of a short bar\" '\n+\ttest_expect_success \"$cmd --stat=width: a long name is given more room when the bar is short\" '\n \t\tgit $cmd $args --stat=40 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect actual\n@@ -131,11 +131,11 @@ test_expect_success 'preparation for long filename tests' '\n '\n \n cat >expect <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++\n EOF\n while read cmd args\n do\n-\ttest_expect_success \"$cmd --stat=width with big change and long name favors name part\" '\n+\ttest_expect_success \"$cmd --stat=width with big change is more balanced\" '\n \t\tgit $cmd $args --stat-width=60 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect actual\n@@ -151,7 +151,7 @@ cat >expect80 <<'EOF'\n  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++\n EOF\n cat >expect200 <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n EOF\n while read verb expect cmd args\n do\n@@ -178,7 +178,7 @@ test_expect_success 'merge --stat respects COLUMNS (big change)' '\n '\n \n cat >expect <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++\n+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++\n EOF\n test_expect_success 'merge --stat respects COLUMNS (long filename)' '\n \tCOLUMNS=100 git merge --stat --no-ff master >output &&\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185813","messageId":"1330604806-30288-7-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 7/9] diff --stat: add a test for output with COLUMNS=40","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:44Z","receivedAt":"2012-03-01T12:26:44Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"In preparation for the introduction on the limit of the width of the\ngraph part, a new test with COLUMNS=40 is added to check that the\nenvironment variable influences diff, show, log, but not format-patch.\nA new test is added because limiting the graph part makes COLUMNS=200\nstop influencing diff --stat behaviour, which isn't wide enough now.\nThe old test with COLUMNS=200 is retained to check for regressions.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4052-stat-output.sh |   19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)\n\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex d0ed0dc..9a8f62d 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -101,6 +101,25 @@ respects expect200 show --stat\n respects expect200 log -1 --stat\n EOF\n \n+cat >expect40 <<'EOF'\n+ abcd | 1000 ++++++++++++++++++++++++++\n+EOF\n+\n+while read verb expect cmd args\n+do\n+\ttest_expect_success \"$cmd $verb not enough COLUMNS (big change)\" '\n+\t\tCOLUMNS=40 git $cmd $args >output\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp \"$expect\" actual\n+\t'\n+done <<\\EOF\n+ignores expect80 format-patch -1 --stdout\n+respects expect40 diff HEAD^ HEAD --stat\n+respects expect40 show --stat\n+respects expect40 log -1 --stat\n+EOF\n+\n+\n cat >expect <<'EOF'\n  abcd | 1000 ++++++++++++++++++++++++++\n EOF\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185814","messageId":"1330604806-30288-8-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 8/9] diff --stat: enable limiting of the graph part","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:45Z","receivedAt":"2012-03-01T12:26:45Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"A new option --stat-graph-width=<width> can be used to limit the width\nof the graph part even is more space is available. Up to <width>\ncolumns will be used for the graph.\n\nIf commits changing a lot of lines are displayed in a wide terminal\nwindow (200 or more columns), and the +- graph uses the full width,\nthe output can be hard to comfortably scan with a horizontal movement\nof human eyes. Messages wrapped to about 80 columns would be\ninterspersed with very long +- lines. It makes sense to limit the\nwidth of the graph part to a fixed value (e.g. 70 columns), even if\nmore columns are available.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/diff-options.txt |    2 ++\n diff.c                         |   23 +++++++++++++++++++++--\n diff.h                         |    1 +\n t/t4052-stat-output.sh         |    6 ++++++\n 4 files changed, 30 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 6b9408f..d34efd5 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -59,6 +59,8 @@ endif::git-format-patch[]\n \tor 80 columns if not connected to a terminal, and can be\n \toverriden by `<width>`. The width of the filename part can be\n \tlimited by giving another width `<name-width>` after a comma.\n+\tThe width of the graph part can be limited by using\n+\t`--stat-graph-width=<width>`.\n \tBy giving a third parameter `<count>`, you can limit the\n \toutput to the first `<count>` lines, followed by `...` if\n \tthere are more.\ndiff --git a/diff.c b/diff.c\nindex 1656310..8f2abc8 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1375,13 +1375,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t/*\n \t * We have width = stat_width or term_columns() columns total.\n \t * We want a maximum of min(max_len, stat_name_width) for the name part.\n+\t * We want a maximum of min(max_change, stat_graph_width) for the +- part.\n \t * We also need 1 for \" \" and 4 + decimal_width(max_change)\n \t * for \" | NNNN \" and one the empty column at the end, altogether\n \t * 6 + decimal_width(max_change).\n \t *\n \t * If there's not enough space, we will use the smaller of\n \t * stat_name_width (if set) and 5/8*width for the filename,\n-\t * and the rest for constant elements + graph part.\n+\t * and the rest for constant elements + graph part, but no more\n+\t * than stat_graph_width for the graph part.\n \t * (5/8 gives 50 for filename and 30 for the constant parts + graph\n \t * for the standard terminal size).\n \t *\n@@ -1406,7 +1408,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t/*\n \t * First assign sizes that are wanted, ignoring available width.\n \t */\n-\tgraph_width = max_change;\n+\tgraph_width = (options->stat_graph_width &&\n+\t\t       options->stat_graph_width < max_change) ?\n+\t\toptions->stat_graph_width : max_change;\n \tname_width = (options->stat_name_width > 0 &&\n \t\t      options->stat_name_width < max_len) ?\n \t\toptions->stat_name_width : max_len;\n@@ -1417,6 +1421,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \tif (name_width + number_width + 6 + graph_width > width) {\n \t\tif (graph_width > width * 3/8 - number_width - 6)\n \t\t\tgraph_width = width * 3/8 - number_width - 6;\n+\t\tif (options->stat_graph_width &&\n+\t\t    graph_width > options->stat_graph_width)\n+\t\t\tgraph_width = options->stat_graph_width;\n \t\tif (name_width > width - number_width - 6 - graph_width)\n \t\t\tname_width = width - number_width - 6 - graph_width;\n \t\telse\n@@ -3289,6 +3296,7 @@ static int stat_opt(struct diff_options *options, const char **av)\n \tchar *end;\n \tint width = options->stat_width;\n \tint name_width = options->stat_name_width;\n+\tint graph_width = options->stat_graph_width;\n \tint count = options->stat_count;\n \tint argcount = 1;\n \n@@ -3317,6 +3325,16 @@ static int stat_opt(struct diff_options *options, const char **av)\n \t\t\t\tname_width = strtoul(av[1], &end, 10);\n \t\t\t\targcount = 2;\n \t\t\t}\n+\t\t} else if (!prefixcmp(arg, \"-graph-width\")) {\n+\t\t\targ += strlen(\"-graph-width\");\n+\t\t\tif (*arg == '=')\n+\t\t\t\tgraph_width = strtoul(arg + 1, &end, 10);\n+\t\t\telse if (!*arg && !av[1])\n+\t\t\t\tdie(\"Option '--stat-graph-width' requires a value\");\n+\t\t\telse if (!*arg) {\n+\t\t\t\tgraph_width = strtoul(av[1], &end, 10);\n+\t\t\t\targcount = 2;\n+\t\t\t}\n \t\t} else if (!prefixcmp(arg, \"-count\")) {\n \t\t\targ += strlen(\"-count\");\n \t\t\tif (*arg == '=')\n@@ -3342,6 +3360,7 @@ static int stat_opt(struct diff_options *options, const char **av)\n \t\treturn 0;\n \toptions->output_format |= DIFF_FORMAT_DIFFSTAT;\n \toptions->stat_name_width = name_width;\n+\toptions->stat_graph_width = graph_width;\n \toptions->stat_width = width;\n \toptions->stat_count = count;\n \treturn argcount;\ndiff --git a/diff.h b/diff.h\nindex ae71f4c..2021a1d 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -129,6 +129,7 @@ struct diff_options {\n \n \tint stat_width;\n \tint stat_name_width;\n+\tint stat_graph_width;\n \tint stat_count;\n \tconst char *word_regex;\n \tenum diff_words_type word_diff;\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 9a8f62d..3d823af 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -136,6 +136,12 @@ do\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect actual\n \t'\n+\n+\ttest_expect_success \"$cmd --stat-graph--width with big change\" '\n+\t\tgit $cmd $args --stat-graph-width=26 >output\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect actual\n+\t'\n done <<\\EOF\n format-patch -1 --stdout\n diff HEAD^ HEAD --stat\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185815","messageId":"1330604806-30288-9-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"1330604806-30288-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7a 9/9] diff --stat: add config option to limit graph width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-01T12:26:46Z","receivedAt":"2012-03-01T12:26:46Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Config option diff.statGraphWidth=<width> is equivalent to\n--stat-graph-width=<width>, except that the config option is ignored\nby format-patch.\n\nFor the graph-width limiting to be usable, it should happen\n'automatically' once configured, hence the config option.\nNevertheless, graph width limiting only makes sense when used on a\nwide terminal, so it should not influence the output of format-patch,\nwhich adheres to the 80-column standard.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/diff-config.txt          |    4 ++++\n Documentation/diff-options.txt         |   16 +++++++++-------\n builtin/diff.c                         |    3 ++-\n builtin/log.c                          |    1 +\n builtin/merge.c                        |    1 +\n contrib/completion/git-completion.bash |    1 +\n diff.c                                 |    8 ++++++++\n t/t4052-stat-output.sh                 |    6 ++++++\n 8 files changed, 32 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 1aed79e..6aa1be0 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -52,6 +52,10 @@ directories with less than 10% of the total amount of changed files,\n and accumulating child directory counts in the parent directories:\n `files,10,cumulative`.\n \n+diff.statGraphWidth::\n+\tLimit the width of the graph part in --stat output. If set, applies\n+\tto all commands generating --stat outuput except format-patch.\n+\n diff.external::\n \tIf this config variable is set, diff generation is not\n \tperformed using the internal diff machinery, but using the\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex d34efd5..87f0a5f 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -54,13 +54,15 @@ endif::git-format-patch[]\n \n --stat[=<width>[,<name-width>[,<count>]]]::\n \tGenerate a diffstat. By default, as much space as necessary\n-\twill be used for the filename part, and the rest for\n-\tthe graph part. Maximum width defaults to terminal width,\n-\tor 80 columns if not connected to a terminal, and can be\n-\toverriden by `<width>`. The width of the filename part can be\n-\tlimited by giving another width `<name-width>` after a comma.\n-\tThe width of the graph part can be limited by using\n-\t`--stat-graph-width=<width>`.\n+\twill be used for the filename part, and the rest for the graph\n+\tpart. Maximum width defaults to terminal width, or 80 columns\n+\tif not connected to a terminal, and can be overriden by\n+\t`<width>`. The width of the filename part can be limited by\n+\tgiving another width `<name-width>` after a comma. The width\n+\tof the graph part can be limited by using\n+\t`--stat-graph-width=<width>` (affects all commands generating\n+\ta stat graph) or by setting `diff.statGraphWidth=<width>`\n+\t(does not affect `git format-patch`).\n \tBy giving a third parameter `<count>`, you can limit the\n \toutput to the first `<count>` lines, followed by `...` if\n \tthere are more.\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 81b6bae..424c815 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -285,8 +285,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \t/* Otherwise, we are doing the usual \"git\" diff */\n \trev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;\n \n-\t/* Scale to real terminal size */\n+\t/* Scale to real terminal size and respect statGraphWidth config */\n \trev.diffopt.stat_width = -1;\n+\trev.diffopt.stat_graph_width = -1;\n \n \t/* Default to let external and textconv be used */\n \tDIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 075a427..8a47012 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -78,6 +78,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)\n \trev->verbose_header = 1;\n \tDIFF_OPT_SET(&rev->diffopt, RECURSIVE);\n \trev->diffopt.stat_width = -1; /* use full terminal width */\n+\trev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */\n \trev->abbrev_commit = default_abbrev_commit;\n \trev->show_root_diff = default_show_root;\n \trev->subject_prefix = fmt_patch_subject_prefix;\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex b1cd90c..34a5034 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -400,6 +400,7 @@ static void finish(struct commit *head_commit,\n \t\tstruct diff_options opts;\n \t\tdiff_setup(&opts);\n \t\topts.stat_width = -1; /* use full terminal width */\n+\t\topts.stat_graph_width = -1; /* respect statGraphWidth config */\n \t\topts.output_format |=\n \t\t\tDIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;\n \t\topts.detect_rename = DIFF_DETECT_RENAME;\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 78be195..bacf403 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2118,6 +2118,7 @@ _git_config ()\n \t\tcore.whitespace\n \t\tcore.worktree\n \t\tdiff.autorefreshindex\n+\t\tdiff.statGraphWidth\n \t\tdiff.external\n \t\tdiff.ignoreSubmodules\n \t\tdiff.mnemonicprefix\ndiff --git a/diff.c b/diff.c\nindex 8f2abc8..4525cda 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -31,6 +31,7 @@ static const char *external_diff_cmd_cfg;\n int diff_auto_refresh_index = 1;\n static int diff_mnemonic_prefix;\n static int diff_no_prefix;\n+static int diff_stat_graph_width;\n static int diff_dirstat_permille_default = 30;\n static struct diff_options default_diff_options;\n \n@@ -156,6 +157,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)\n \t\tdiff_no_prefix = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"diff.statgraphwidth\")) {\n+\t\tdiff_stat_graph_width = git_config_int(var, value);\n+\t\treturn 0;\n+\t}\n \tif (!strcmp(var, \"diff.external\"))\n \t\treturn git_config_string(&external_diff_cmd_cfg, var, value);\n \tif (!strcmp(var, \"diff.wordregex\"))\n@@ -1398,6 +1403,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \telse\n \t\twidth = options->stat_width ? options->stat_width : 80;\n \n+\tif (options->stat_graph_width == -1)\n+\t\toptions->stat_graph_width = diff_stat_graph_width;\n+\n \t/*\n \t * Guarantee 3/8*16==6 for the graph part\n \t * and 5/8*16==10 for the filename part\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 3d823af..328aa8f 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -112,6 +112,12 @@ do\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp \"$expect\" actual\n \t'\n+\n+\ttest_expect_success \"$cmd $verb statGraphWidth config\" '\n+\t\tgit -c diff.statGraphWidth=26 $cmd $args >output\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp \"$expect\" actual\n+\t'\n done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n respects expect40 diff HEAD^ HEAD --stat\n-- \n1.7.9.2.399.gdf4d.dirty\n"},{"id":"185830","messageId":"7vfwdsnst0.fsf@alter.siamese.dyndns.org","threadId":"29768","inReplyTo":"1330604806-30288-6-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH v7a 6/9] diff --stat: use a maximum of 5/8 for the filename part","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-01T17:18:35Z","receivedAt":"2012-03-01T17:18:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:\n\n> The effect of this change is visible in the patch to the test vector\n> in t4014; with a small change with long filename, it stops truncating\n> the name part too short, and also allocates a bit more columns to the\n> graph for larger changes.  t4052 shows a similar change.\n\nI replaced 4014 with 4052 in the first sentence, and dropped the last\nsentence and re-queued the whole series.\n\nThanks for cleaning it up.  Very much appreciated.\n"},{"id":"187796","messageId":"20120326234549.GA10172@sigill.intra.peff.net","threadId":"29768","inReplyTo":"1330604806-30288-6-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH v7a 6/9] diff --stat: use a maximum of 5/8 for the filename part","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-03-26T23:45:49Z","receivedAt":"2012-03-26T23:45:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 01, 2012 at 01:26:43PM +0100, Zbigniew Jędrzejewski-Szmek wrote:\n\n> ---\n>  Documentation/diff-options.txt |   14 ++++---\n>  diff.c                         |   90 ++++++++++++++++++++++++++--------------\n>  t/t4052-stat-output.sh         |   16 +++----\n>  3 files changed, 76 insertions(+), 44 deletions(-)\n\nI am seeing test failures from t4052 in 'master'. Bisecting points to\n1b058bc (diff --stat: use a maximum of 5/8 for the filename part,\n2012-03-01). The output from the test script looks like this:\n\n--- expect      2012-03-26 23:41:29.688039554 +0000\n+++ actual      2012-03-26 23:41:29.696039549 +0000\n@@ -1 +1 @@\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\nnot ok - 8 diff: small change with long name gives more space to the name\n#       \n#                       git $cmd $args >output &&\n#                       grep \" | \" output >actual &&\n#                       test_cmp expect actual\n#               \n\nThere are a few other failures, but they all have the same mismatched\nlength (the output is slightly longer than expected). I know Junio won't\npush out a 'master' that doesn't pass the tests for him, so I'm\nwondering if some environment information like the terminal width is\nleaking through the test scripts.\n\nI haven't actually investigated any further yet, but I thought I'd first\nsee if anything obvious occurs to you.\n\n-Peff\n"},{"id":"187815","messageId":"1332825003-2288-1-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"20120326234549.GA10172@sigill.intra.peff.net","subject":"[PATCH] t4052: unset $COLUMNS inherited from environment","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-27T05:10:03Z","receivedAt":"2012-03-27T05:10:03Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"$COLUMNS must be unset to not interfere with the tests. The tests\nalready ignore the terminal size because output is redirected to a\nfile, but $COLUMNS overrides terminal size detection and changes the\ntest output away from the standard 80 even if not on a terminal.\n\nReported-by: Jeff King <peff@peff.net>\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\nStupid omission. Please apply.\n\n t/t4052-stat-output.sh |    1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 328aa8f..1f47f1d 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -17,6 +17,7 @@ test_expect_success 'preparation' '\n \tgit commit -m message &&\n \techo a >\"$name\" &&\n \tgit commit -m message \"$name\"\n+\tsane_unset COLUMNS\n '\n \n while read cmd args\n-- \n1.7.10.rc1.222.gc0040.dirty\n"},{"id":"187817","messageId":"20120327051714.GB20897@sigill.intra.peff.net","threadId":"29768","inReplyTo":"1332825003-2288-1-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH] t4052: unset $COLUMNS inherited from environment","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-03-27T05:17:14Z","receivedAt":"2012-03-27T05:17:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2012 at 07:10:03AM +0200, Zbigniew Jędrzejewski-Szmek wrote:\n\n> $COLUMNS must be unset to not interfere with the tests. The tests\n> already ignore the terminal size because output is redirected to a\n> file, but $COLUMNS overrides terminal size detection and changes the\n> test output away from the standard 80 even if not on a terminal.\n> \n> Reported-by: Jeff King <peff@peff.net>\n> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n> ---\n> Stupid omission. Please apply.\n\nThanks. I had a feeling it was something like this, but when I went to\ntest again, I couldn't reproduce! It seems that COLUMNS is not exported\nby default, but somehow I must have exported it accidentally.\n\n> diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\n> index 328aa8f..1f47f1d 100755\n> --- a/t/t4052-stat-output.sh\n> +++ b/t/t4052-stat-output.sh\n> @@ -17,6 +17,7 @@ test_expect_success 'preparation' '\n>  \tgit commit -m message &&\n>  \techo a >\"$name\" &&\n>  \tgit commit -m message \"$name\"\n> +\tsane_unset COLUMNS\n>  '\n\nShould we perhaps just unset it in test-lib.sh, along with the other\nvariables that cause an inconsistent test environment? This is the only\ntest script that breaks now, but there's no reason not to protect all of\nthe scripts.\n\n-Peff\n"},{"id":"187820","messageId":"4F7150F9.50806@viscovery.net","threadId":"29768","inReplyTo":"1332825003-2288-1-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH] t4052: unset $COLUMNS inherited from environment","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-03-27T05:32:41Z","receivedAt":"2012-03-27T05:32:41Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 3/27/2012 7:10, schrieb Zbigniew Jędrzejewski-Szmek:\n> diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\n> index 328aa8f..1f47f1d 100755\n> --- a/t/t4052-stat-output.sh\n> +++ b/t/t4052-stat-output.sh\n> @@ -17,6 +17,7 @@ test_expect_success 'preparation' '\n>  \tgit commit -m message &&\n>  \techo a >\"$name\" &&\n>  \tgit commit -m message \"$name\"\n> +\tsane_unset COLUMNS\n>  '\n\nWatch out, the && chain is broken here.\n\n-- Hannes\n"},{"id":"187828","messageId":"1332829323-6048-1-git-send-email-zbyszek@in.waw.pl","threadId":"29768","inReplyTo":"20120327051714.GB20897@sigill.intra.peff.net","subject":"[PATCH v2] tests: unset COLUMNS inherited from environment","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-03-27T06:22:02Z","receivedAt":"2012-03-27T06:22:02Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"$COLUMNS must be unset to not interfere with the tests. The tests\nalready ignore the terminal size because output is redirected to a\nfile, but COLUMNS overrides terminal size detection and changes the\ntest output away from the standard 80.\n\nReported-by: Jeff King <peff@peff.net>\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\nRight, it is better to unset $COLUMNS globally. t4016 was also affected.\n\n t/test-lib.sh |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 30ed4d7..b7d7100 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -46,7 +46,7 @@ EDITOR=:\n # /usr/xpg4/bin/sh and /bin/ksh to bail out.  So keep the unsets\n # deriving from the command substitution clustered with the other\n # ones.\n-unset VISUAL EMAIL LANGUAGE $(perl -e '\n+unset VISUAL EMAIL LANGUAGE COLUMNS $(perl -e '\n \tmy @env = keys %ENV;\n \tmy $ok = join(\"|\", qw(\n \t\tTRACE\n-- \n1.7.10.rc1.222.gc0040.dirty\n"},{"id":"187881","messageId":"20120327184426.GC8460@sigill.intra.peff.net","threadId":"29768","inReplyTo":"1332829323-6048-1-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH v2] tests: unset COLUMNS inherited from environment","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-03-27T18:44:26Z","receivedAt":"2012-03-27T18:44:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2012 at 08:22:02AM +0200, Zbigniew Jędrzejewski-Szmek wrote:\n\n> $COLUMNS must be unset to not interfere with the tests. The tests\n> already ignore the terminal size because output is redirected to a\n> file, but COLUMNS overrides terminal size detection and changes the\n> test output away from the standard 80.\n> \n> Reported-by: Jeff King <peff@peff.net>\n> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n> ---\n> Right, it is better to unset $COLUMNS globally. t4016 was also affected.\n\nThanks. Solves the problem for me, and looks obviously correct.\n\n-Peff\n"}]}