{"thread":{"id":"29675","subject":"[PATCH 0/8 v6] diff --stat: use the full terminal width","startedAt":"2012-02-20T21:57:06Z","lastAt":"2012-02-24T20:32:18Z","messageCount":35,"participants":["Zbigniew Jędrzejewski-Szmek","Junio C Hamano","Nguyen Thai Ngoc Duy","Miles Bader"],"isPatch":true,"patchVersion":6,"patchTotal":8},"messages":[{"id":"185028","messageId":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":null,"subject":"[PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:06Z","receivedAt":"2012-02-20T21:57:06Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Hi,\n\nthis is v6, with a new approach. The biggest change is that now the\nfull terminal width is used in show_stats() only when explictely\nrequested by the calling code. This is done by setting stat_width=-1\nin diffopts in the builtin commands diff, stat, log, and merge. The\nseries includes to-be-squashed-eds from Junio and is also structured\ndifferently. I followed Junio's advice and split the change to use\nfull terminal-width, into two patches: one which makes show_stats()\nstart using term_columns(), and a second one which changes the logic\nto divide available columns. This proved to be a good move because it\ncaught a bug/deficiency in the tests: the tests I added tried to\nverify that format-patch output ignores COLUMNS by setting\nCOLUMNS=200. Unfortunately, because the graph part was limited to 40\ncolumns, the maximum output was less than 80 columns, the test\ndidn't really check anything. New tests check with both 40 and 200\ncolumns to verify that it really works.\n\nSince there were conflicts with 'jc/diff-stat-scaler' and\n'nd/diffstat-gramnum', this re-roll is rebased on top of those two\nbranches.\n\nv6:\n\n[1/8]  make lineno_width() from blame reusable for others\n  This is very close to what was in pu, but I'm sending a new version:\n  - the function argument is changed from int to uintmax_t\n    (max_change is uintmax_t and 9/9 does decimal_width(max_change).)\n[2/8] diff --stat: tests for long filenames and big change counts\n  - Tests are run for format-patch, diff, log, show, and merge.\n  - Since tests are not only for format-patch, they are added in a new\n    file t/t4052-stat-output.sh.\n[3/8] diff --stat: use the full terminal width\n  Add logic to use term_columns() when diffopts.stat_width==-1 and\n  turn it on in git-diff --stat.\n  - show_stats() output is adapted to full terminal width only when\n    diffopts.stat_width==-1.\n[4/8] show --stat: use the full terminal width\n  Enable for git-show.\n[5/8] log --stat: use the full terminal width\n  Enable for log-show.\n[6/8] merge --stat: use the full terminal width\n  Enable for git-merge.\n[7/8] diff --stat: limit graph part to 40 columns\n  Change the logic to divide columns. This part is the unchanged from \n  v5, just separated from 3/9.\n[8/8] diff --stat: use less columns for change counts\n  This one is optional, to be applied or not, \"when the dust settles\".\n\nOpen questions:\nJC:\n> Perhaps the maximum for garph_width should be raised to something like\n> \"min(80, stat_width) - name_width\"?\nI think that a graph like\na | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\nb |    1 -\nis not very readable. I like the consistency forced by the 40-column limit.\nBut I guess that this is very subjective.\n\nNTC:\n> If the required number of columns is less than 80 (or even lower), can\n> we maintain current spacing strategy? I just want to avoid mass\n> updates in the test suite. More or less space does not make much\n> different for narrow diffstats anyway.\nPatch 9/9 does this \"massive\" change. It touches many files but is\ncompletely trivial. I hope it'll not be a problem.\n\nZbyszek\n\n\nv5:\n- tests are moved to an earlier patch\n  - seq is replaced with a while loop for windows compatibility\n  - grep -m 1 is replaced with grep \" | \"\n  - redirects are made portable\n  - piped output is split into two commands to verify that the first command\n    sucessfully runs to completion\n- using decimal_width(change count) is moved to a later patch\n- \"histogram\" is really not used\n\n\nv4:\n- comments are updated and the word \"histogram\" is banished\n- \"mopping up\" is removed (but the minimum width are guaranteed)\n\nv3:\n- use decimal_width(max_change) to calculate number of columns\n  required for change counts\n- rework the logic to divide columns\n- document the logic in comments, update docs\n- add more tests\n\nv2:\n- style fixes\n- some tests for git-format-patch added\n- patches 3 and 4 squashed together, since they touch the same lines\n- graph width is limited to 40 columns, even if there's more space\n- patch descriptions extended and cleared up\n\n Documentation/diff-options.txt                     |  14 +-\n Documentation/gitcore-tutorial.txt                 |   4 +-\n builtin/blame.c                                    |  18 +-\n builtin/diff.c                                     |   3 +\n builtin/log.c                                      |   3 +\n builtin/merge.c                                    |   1 +\n builtin/reset.c                                    |   2 +\n cache.h                                            |   1 +\n diff.c                                             | 129 ++++++++++----\n pager.c                                            |  13 ++\n t/t0023-crlf-am.sh                                 |   2 +-\n t/t1200-tutorial.sh                                |   4 +-\n t/t3404-rebase-interactive.sh                      |   2 +-\n t/t3903-stash.sh                                   |   4 +-\n t/t4012-diff-binary.sh                             |  19 +++\n ...ff-tree_--cc_--patch-with-stat_--summary_master |   4 +-\n ...diff-tree_--cc_--patch-with-stat_--summary_side |   6 +-\n .../diff.diff-tree_--cc_--patch-with-stat_master   |   4 +-\n .../diff.diff-tree_--cc_--stat_--summary_master    |   4 +-\n t/t4013/diff.diff-tree_--cc_--stat_--summary_side  |   6 +-\n t/t4013/diff.diff-tree_--cc_--stat_master          |   4 +-\n ...pretty=oneline_--root_--patch-with-stat_initial |   6 +-\n .../diff.diff-tree_--pretty_--patch-with-stat_side |   6 +-\n ...-tree_--pretty_--root_--patch-with-stat_initial |   6 +-\n ...f-tree_--pretty_--root_--stat_--summary_initial |   6 +-\n .../diff.diff-tree_--pretty_--root_--stat_initial  |   6 +-\n ...diff.diff-tree_--root_--patch-with-stat_initial |   6 +-\n t/t4013/diff.diff-tree_-c_--stat_--summary_master  |   4 +-\n t/t4013/diff.diff-tree_-c_--stat_--summary_side    |   6 +-\n t/t4013/diff.diff-tree_-c_--stat_master            |   4 +-\n .../diff.diff_--patch-with-stat_-r_initial..side   |   6 +-\n t/t4013/diff.diff_--patch-with-stat_initial..side  |   6 +-\n t/t4013/diff.diff_--stat_initial..side             |   6 +-\n t/t4013/diff.diff_-r_--stat_initial..side          |   6 +-\n ..._--attach_--stdout_--suffix=.diff_initial..side |   6 +-\n ....format-patch_--attach_--stdout_initial..master |  16 +-\n ...format-patch_--attach_--stdout_initial..master^ |  10 +-\n ...ff.format-patch_--attach_--stdout_initial..side |   6 +-\n ...nline_--stdout_--numbered-files_initial..master |  16 +-\n ...tdout_--subject-prefix=TESTCASE_initial..master |  16 +-\n ....format-patch_--inline_--stdout_initial..master |  16 +-\n ...format-patch_--inline_--stdout_initial..master^ |  10 +-\n ...ormat-patch_--inline_--stdout_initial..master^^ |   6 +-\n ...ff.format-patch_--inline_--stdout_initial..side |   6 +-\n ...tch_--stdout_--cover-letter_-n_initial..master^ |  18 +-\n ...at-patch_--stdout_--no-numbered_initial..master |  16 +-\n ...ormat-patch_--stdout_--numbered_initial..master |  16 +-\n t/t4013/diff.format-patch_--stdout_initial..master |  16 +-\n .../diff.format-patch_--stdout_initial..master^    |  10 +-\n t/t4013/diff.format-patch_--stdout_initial..side   |   6 +-\n ....log_--patch-with-stat_--summary_master_--_dir_ |   6 +-\n t/t4013/diff.log_--patch-with-stat_master          |  16 +-\n t/t4013/diff.log_--patch-with-stat_master_--_dir_  |   6 +-\n ..._--root_--cc_--patch-with-stat_--summary_master |  26 +--\n ...f.log_--root_--patch-with-stat_--summary_master |  22 +--\n t/t4013/diff.log_--root_--patch-with-stat_master   |  22 +--\n ...og_--root_-c_--patch-with-stat_--summary_master |  26 +--\n t/t4013/diff.show_--patch-with-stat_--summary_side |   6 +-\n t/t4013/diff.show_--patch-with-stat_side           |   6 +-\n t/t4013/diff.show_--stat_--summary_side            |   6 +-\n t/t4013/diff.show_--stat_side                      |   6 +-\n ...nged_--patch-with-stat_--summary_master_--_dir_ |   6 +-\n t/t4013/diff.whatchanged_--patch-with-stat_master  |  16 +-\n ...ff.whatchanged_--patch-with-stat_master_--_dir_ |   6 +-\n ..._--root_--cc_--patch-with-stat_--summary_master |  26 +--\n ...anged_--root_--patch-with-stat_--summary_master |  22 +--\n ...iff.whatchanged_--root_--patch-with-stat_master |  22 +--\n ...ed_--root_-c_--patch-with-stat_--summary_master |  26 +--\n t/t4014-format-patch.sh                            |   2 +-\n t/t4016-diff-quote.sh                              |  14 +-\n t/t4030-diff-textconv.sh                           |   2 +-\n t/t4043-diff-rename-binary.sh                      |   4 +-\n t/t4045-diff-relative.sh                           |   2 +-\n t/t4047-diff-dirstat.sh                            |  54 +++---\n t/t4049-diff-stat-count.sh                         |   4 +-\n t/t4052-stat-output.sh                             | 189 +++++++++++++++++++++\n t/t5100/patch0001                                  |   2 +-\n t/t5100/patch0002                                  |   2 +-\n t/t5100/patch0003                                  |   2 +-\n t/t5100/patch0005                                  |   4 +-\n t/t5100/patch0006                                  |   2 +-\n t/t5100/patch0010                                  |   2 +-\n t/t5100/patch0011                                  |   2 +-\n t/t5100/patch0014                                  |   2 +-\n t/t5100/patch0014--scissors                        |   2 +-\n t/t5100/sample.mbox                                |  18 +-\n t/t7602-merge-octopus-many.sh                      |  12 +-\n 87 files changed, 695 insertions(+), 409 deletions(-)\n create mode 100755 t/t4052-stat-output.sh\n\n-- \n1.7.9.1.354.ge34f3\n"},{"id":"185029","messageId":"1329775034-21551-2-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 1/8 v6] make lineno_width() from blame reusable for others","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:07Z","receivedAt":"2012-02-20T21:57:07Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"builtin/blame.c has a helper function to compute how many columns we\nneed to show a line-number, whose implementation is reusable as a more\ngeneric helper function to count the number of columns necessary to\nshow any cardinal number.\n\nRename it to decimal_width(), move it to pager.c and export it for use\nby future callers.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n builtin/blame.c | 18 +++---------------\n cache.h         |  1 +\n pager.c         | 13 +++++++++++++\n 3 files changed, 17 insertions(+), 15 deletions(-)\n\ndiff --git builtin/blame.c builtin/blame.c\nindex 01956c8..b35bd62 100644\n--- builtin/blame.c\n+++ builtin/blame.c\n@@ -1829,18 +1829,6 @@ static int read_ancestry(const char *graft_file)\n }\n \n /*\n- * How many columns do we need to show line numbers in decimal?\n- */\n-static int lineno_width(int lines)\n-{\n-\tint i, width;\n-\n-\tfor (width = 1, i = 10; i <= lines; width++)\n-\t\ti *= 10;\n-\treturn width;\n-}\n-\n-/*\n  * How many columns do we need to show line numbers, authors,\n  * and filenames?\n  */\n@@ -1880,9 +1868,9 @@ static void find_alignment(struct scoreboard *sb, int *option)\n \t\tif (largest_score < ent_score(sb, e))\n \t\t\tlargest_score = ent_score(sb, e);\n \t}\n-\tmax_orig_digits = lineno_width(longest_src_lines);\n-\tmax_digits = lineno_width(longest_dst_lines);\n-\tmax_score_digits = lineno_width(largest_score);\n+\tmax_orig_digits = decimal_width(longest_src_lines);\n+\tmax_digits = decimal_width(longest_dst_lines);\n+\tmax_score_digits = decimal_width(largest_score);\n }\n \n /*\ndiff --git cache.h cache.h\nindex 9ecdf76..980d95d 100644\n--- cache.h\n+++ cache.h\n@@ -1198,6 +1198,7 @@ extern const char *pager_program;\n extern int pager_in_use(void);\n extern int pager_use_color;\n extern int term_columns(void);\n+extern int decimal_width(uintmax_t number);\n \n extern const char *editor_program;\n extern const char *askpass_program;\ndiff --git pager.c pager.c\nindex b790967..60be7bb 100644\n--- pager.c\n+++ pager.c\n@@ -147,3 +147,16 @@ int term_columns(void)\n \n \treturn term_columns_at_startup;\n }\n+\n+/*\n+ * How many columns do we need to show this number in decimal?\n+ */\n+int decimal_width(uintmax_t number)\n+{\n+\tint width;\n+\tuintmax_t i;\n+\n+\tfor (width = 1, i = 10; i <= number; width++)\n+\t\ti *= 10;\n+\treturn width;\n+}\n-- \n1.7.9.1.353.g684b4\n"},{"id":"185033","messageId":"1329775034-21551-3-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 2/8 v6] diff --stat: tests for long filenames and big change counts","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:08Z","receivedAt":"2012-02-20T21:57:08Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"In 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.  A couple of new tests marked with test_expect_failure\ndemonstrate this bug.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\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 t/t4052-stat-output.sh t/t4052-stat-output.sh\nnew file mode 100755\nindex 0000000..031107b\n--- /dev/null\n+++ 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+cat >expect80 <<'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+EOF\n+\n+cat >expect40 <<-'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+EOF\n+\n+while read cmd args\n+do\n+\ttest_expect_failure \"$cmd graph width defaults to 80 columns\" '\n+\t\tgit $cmd $args >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect80 actual\n+\t'\n+\n+\ttest_expect_failure \"$cmd --stat=width with long name\" '\n+\t\tgit $cmd $args --stat=40 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect40 actual\n+\t'\n+\n+\ttest_expect_failure \"$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 expect40 actual\n+\t'\n+\n+\ttest_expect_success \"$cmd --stat=...,name-width with long name\" '\n+\t\tgit $cmd $args --stat=60,29 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect40 actual\n+\t'\n+\n+\ttest_expect_success \"$cmd --stat-name-width with long name\" '\n+\t\tgit $cmd $args --stat-name-width=29 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect40 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+\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+\n+while read cmd args\n+do\n+\ttest_expect_success \"$cmd --stat=width with big change and long name\" '\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.1.353.g684b4\n"},{"id":"185031","messageId":"1329775034-21551-4-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 3/8 v6] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:09Z","receivedAt":"2012-02-20T21:57:09Z","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>\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 builtin/diff.c builtin/diff.c\nindex 387afa7..81b6bae 100644\n--- builtin/diff.c\n+++ 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 diff.c diff.c\nindex 01c15da..1db46a4 100644\n--- diff.c\n+++ diff.c\n@@ -1389,7 +1389,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 t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex 031107b..4bfd6a5 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -81,6 +81,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@@ -90,7 +94,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.1.353.g684b4\n"},{"id":"185030","messageId":"1329775034-21551-5-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 4/8 v6] show --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:10Z","receivedAt":"2012-02-20T21:57:10Z","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>\n---\n builtin/log.c          | 2 ++\n t/t4052-stat-output.sh | 4 ++--\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git builtin/log.c builtin/log.c\nindex 7d1f6f8..d37ae26 100644\n--- builtin/log.c\n+++ 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 t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex 4bfd6a5..91c4ba8 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -95,7 +95,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.1.353.g684b4\n"},{"id":"185035","messageId":"1329775034-21551-6-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 5/8 v6] log --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:11Z","receivedAt":"2012-02-20T21:57:11Z","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>\n---\n builtin/log.c          | 1 +\n t/t4052-stat-output.sh | 4 ++--\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git builtin/log.c builtin/log.c\nindex d37ae26..075a427 100644\n--- builtin/log.c\n+++ 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 t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex 91c4ba8..acc54cd 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -96,7 +96,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.1.353.g684b4\n"},{"id":"185034","messageId":"1329775034-21551-7-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 6/8 v6] merge --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:12Z","receivedAt":"2012-02-20T21:57:12Z","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>\n---\n builtin/merge.c        | 1 +\n t/t4052-stat-output.sh | 8 ++++----\n 2 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git builtin/merge.c builtin/merge.c\nindex ed0f959..7b368e7 100644\n--- builtin/merge.c\n+++ 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 t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex acc54cd..2b4510c 100755\n--- t/t4052-stat-output.sh\n+++ 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.1.353.g684b4\n"},{"id":"185032","messageId":"1329775034-21551-8-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 7/8 v6] diff --stat: limit graph part to 40 columns","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:13Z","receivedAt":"2012-02-20T21:57:13Z","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 up to 40 columns 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 would use the full\nwidth, the output would look bad. Messages wrapped to about 80 columns\nwould be interspersed with very long +- lines. It makes sense to limit\nthe width of the graph part to a fixed value, even if more columns are\navailable. This fixed value is subjectively hard-coded to be 40\ncolumns, which seems to work well for git.git and linux-2.6.git and\nsome other repositories.\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 t4052 that fixes a\nfew tests marked with test_expect_failure, and the change to shorten the\nmaximum graph width to 40 columns. Since limiting the graph part to\n40 columns makes COLUMNS=200 stop influencing diff --stat behaviour,\nbecause it isn't wide enough now, a new test with COLUMNS=40 is added\nto check that the environment variable influences diff, show, log, but not\nformat-patch. The old test with COLUMNS=200 is added to check for\nregressions.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n Documentation/diff-options.txt | 14 +++---\n diff.c                         | 94 +++++++++++++++++++++++++++-------------\n t/t4052-stat-output.sh         | 45 ++++++++++++-------\n 3 files changed, 102 insertions(+), 51 deletions(-)\n\ndiff --git Documentation/diff-options.txt Documentation/diff-options.txt\nindex 9ed78c9..e4d0e3e 100644\n--- Documentation/diff-options.txt\n+++ 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 up to 40 columns 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 diff.c diff.c\nindex 1db46a4..8a9a387 100644\n--- diff.c\n+++ diff.c\n@@ -1375,7 +1375,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@@ -1389,28 +1389,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@@ -1431,19 +1418,66 @@ 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 want a maximum of min(max_change, 40) 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, but no more\n+\t * than 40 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-\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 < 40 ? max_change : 40;\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 (graph_width > 40)\n+\t\t\tgraph_width =  40;\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@@ -1499,18 +1533,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 t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex 2b4510c..1b237b7 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -28,19 +28,19 @@ EOF\n \n while read cmd args\n do\n-\ttest_expect_failure \"$cmd graph width defaults to 80 columns\" '\n+\ttest_expect_success \"$cmd graph width defaults to 80 columns\" '\n \t\tgit $cmd $args >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect80 actual\n \t'\n \n-\ttest_expect_failure \"$cmd --stat=width with long name\" '\n+\ttest_expect_success \"$cmd --stat=width with long name\" '\n \t\tgit $cmd $args --stat=40 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect40 actual\n \t'\n \n-\ttest_expect_failure \"$cmd --stat-width=width with long name\" '\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 expect40 actual\n@@ -78,27 +78,42 @@ test_expect_success 'preparation for big change tests' '\n '\n \n cat >expect80 <<'EOF'\n- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++\n EOF\n \n-cat >expect200 <<'EOF'\n- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+while read verb expect cmd args\n+do\n+\ttest_expect_success \"$cmd $verb too many 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+respects expect80 diff HEAD^ HEAD --stat\n+respects expect80 show --stat\n+respects expect80 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 COLUMNS (big change)\" '\n-\t\tCOLUMNS=200 git $cmd $args >output\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 expect200 diff HEAD^ HEAD --stat\n-respects expect200 show --stat\n-respects expect200 log -1 --stat\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@@ -130,7 +145,7 @@ test_expect_success 'preparation for long filename tests' '\n '\n \n cat >expect <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++\n EOF\n \n while read cmd args\n@@ -151,7 +166,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@@ -168,7 +183,7 @@ 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 respects COLUMNS (big change)' '\n \tgit checkout -b branch HEAD^^ &&\n@@ -178,7 +193,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.1.353.g684b4\n"},{"id":"185036","messageId":"1329775034-21551-9-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 8/8 v6] diff --stat: use less columns for change counts","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-20T21:57:14Z","receivedAt":"2012-02-20T21:57:14Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Number of columns required for change counts is computed based on the\nmaximum number of changed lines. This means that usually a few more\ncolumns will be available for the filenames and the graph.\n\nThe graph width logic is also modified to include enough space for\n\"Bin XXX -> YYY bytes\".\n\nIf changes to binary files are mixed with changes to text files,\nchange counts are padded to take at least three columns. And the other\nway around, if change counts require more than three columns, then\n\"Bin\"s are padded to align with the change count. This way, the +-\npart starts in the same column as \"XXX -> YYY\" part for binary files.\nThis makes the graph easier to parse visually thanks to the empty\ncolumn. This mimics the layout of diff --stat before this change.\n\nTests and the tutorial are updated to reflect the new --stat output.\nThis means either the removal of extra padding and/or the addition of\nup to three extra characters to truncated filenames. One test is added\nto check the graph alignment when a binary file change and text file\nchange of more than 999 lines are committed together.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n Documentation/gitcore-tutorial.txt                 |  4 +-\n diff.c                                             | 44 ++++++++++++++----\n t/t0023-crlf-am.sh                                 |  2 +-\n t/t1200-tutorial.sh                                |  4 +-\n t/t3404-rebase-interactive.sh                      |  2 +-\n t/t3903-stash.sh                                   |  4 +-\n t/t4012-diff-binary.sh                             | 19 ++++++++\n ...ff-tree_--cc_--patch-with-stat_--summary_master |  4 +-\n ...diff-tree_--cc_--patch-with-stat_--summary_side |  6 +--\n .../diff.diff-tree_--cc_--patch-with-stat_master   |  4 +-\n .../diff.diff-tree_--cc_--stat_--summary_master    |  4 +-\n t/t4013/diff.diff-tree_--cc_--stat_--summary_side  |  6 +--\n t/t4013/diff.diff-tree_--cc_--stat_master          |  4 +-\n ...pretty=oneline_--root_--patch-with-stat_initial |  6 +--\n .../diff.diff-tree_--pretty_--patch-with-stat_side |  6 +--\n ...-tree_--pretty_--root_--patch-with-stat_initial |  6 +--\n ...f-tree_--pretty_--root_--stat_--summary_initial |  6 +--\n .../diff.diff-tree_--pretty_--root_--stat_initial  |  6 +--\n ...diff.diff-tree_--root_--patch-with-stat_initial |  6 +--\n t/t4013/diff.diff-tree_-c_--stat_--summary_master  |  4 +-\n t/t4013/diff.diff-tree_-c_--stat_--summary_side    |  6 +--\n t/t4013/diff.diff-tree_-c_--stat_master            |  4 +-\n .../diff.diff_--patch-with-stat_-r_initial..side   |  6 +--\n t/t4013/diff.diff_--patch-with-stat_initial..side  |  6 +--\n t/t4013/diff.diff_--stat_initial..side             |  6 +--\n t/t4013/diff.diff_-r_--stat_initial..side          |  6 +--\n ..._--attach_--stdout_--suffix=.diff_initial..side |  6 +--\n ....format-patch_--attach_--stdout_initial..master | 16 +++----\n ...format-patch_--attach_--stdout_initial..master^ | 10 ++--\n ...ff.format-patch_--attach_--stdout_initial..side |  6 +--\n ...nline_--stdout_--numbered-files_initial..master | 16 +++----\n ...tdout_--subject-prefix=TESTCASE_initial..master | 16 +++----\n ....format-patch_--inline_--stdout_initial..master | 16 +++----\n ...format-patch_--inline_--stdout_initial..master^ | 10 ++--\n ...ormat-patch_--inline_--stdout_initial..master^^ |  6 +--\n ...ff.format-patch_--inline_--stdout_initial..side |  6 +--\n ...tch_--stdout_--cover-letter_-n_initial..master^ | 18 ++++----\n ...at-patch_--stdout_--no-numbered_initial..master | 16 +++----\n ...ormat-patch_--stdout_--numbered_initial..master | 16 +++----\n t/t4013/diff.format-patch_--stdout_initial..master | 16 +++----\n .../diff.format-patch_--stdout_initial..master^    | 10 ++--\n t/t4013/diff.format-patch_--stdout_initial..side   |  6 +--\n ....log_--patch-with-stat_--summary_master_--_dir_ |  6 +--\n t/t4013/diff.log_--patch-with-stat_master          | 16 +++----\n t/t4013/diff.log_--patch-with-stat_master_--_dir_  |  6 +--\n ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++------\n ...f.log_--root_--patch-with-stat_--summary_master | 22 ++++-----\n t/t4013/diff.log_--root_--patch-with-stat_master   | 22 ++++-----\n ...og_--root_-c_--patch-with-stat_--summary_master | 26 +++++------\n t/t4013/diff.show_--patch-with-stat_--summary_side |  6 +--\n t/t4013/diff.show_--patch-with-stat_side           |  6 +--\n t/t4013/diff.show_--stat_--summary_side            |  6 +--\n t/t4013/diff.show_--stat_side                      |  6 +--\n ...nged_--patch-with-stat_--summary_master_--_dir_ |  6 +--\n t/t4013/diff.whatchanged_--patch-with-stat_master  | 16 +++----\n ...ff.whatchanged_--patch-with-stat_master_--_dir_ |  6 +--\n ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++------\n ...anged_--root_--patch-with-stat_--summary_master | 22 ++++-----\n ...iff.whatchanged_--root_--patch-with-stat_master | 22 ++++-----\n ...ed_--root_-c_--patch-with-stat_--summary_master | 26 +++++------\n t/t4014-format-patch.sh                            |  2 +-\n t/t4016-diff-quote.sh                              | 14 +++---\n t/t4030-diff-textconv.sh                           |  2 +-\n t/t4043-diff-rename-binary.sh                      |  4 +-\n t/t4045-diff-relative.sh                           |  2 +-\n t/t4047-diff-dirstat.sh                            | 54 +++++++++++-----------\n t/t4049-diff-stat-count.sh                         |  4 +-\n t/t4052-stat-output.sh                             |  8 ++--\n t/t5100/patch0001                                  |  2 +-\n t/t5100/patch0002                                  |  2 +-\n t/t5100/patch0003                                  |  2 +-\n t/t5100/patch0005                                  |  4 +-\n t/t5100/patch0006                                  |  2 +-\n t/t5100/patch0010                                  |  2 +-\n t/t5100/patch0011                                  |  2 +-\n t/t5100/patch0014                                  |  2 +-\n t/t5100/patch0014--scissors                        |  2 +-\n t/t5100/sample.mbox                                | 18 ++++----\n t/t7602-merge-octopus-many.sh                      | 12 ++---\n 79 files changed, 415 insertions(+), 368 deletions(-)\n\ndiff --git Documentation/gitcore-tutorial.txt Documentation/gitcore-tutorial.txt\nindex fb0d569..5b5d5a4 100644\n--- Documentation/gitcore-tutorial.txt\n+++ Documentation/gitcore-tutorial.txt\n@@ -1002,8 +1002,8 @@ would be different)\n ----------------\n Updating from ae3a2da... to a80b4aa....\n Fast-forward (no commit created; -m option ignored)\n- example |    1 +\n- hello   |    1 +\n+ example | 1 +\n+ hello   | 1 +\n  2 files changed, 2 insertions(+)\n ----------------\n \ndiff --git diff.c diff.c\nindex 8a9a387..b4b35d6 100644\n--- diff.c\n+++ diff.c\n@@ -1374,8 +1374,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n {\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, graph_width, number_width = 4, count;\n+\tint total_files = data->nr, count;\n+\tint width, name_width, graph_width, number_width = 0, bin_width = 0;\n \tconst char *reset, *add_c, *del_c;\n \tconst char *line_prefix = \"\";\n \tint extra_shown = 0;\n@@ -1411,8 +1411,21 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\tif (max_len < len)\n \t\t\tmax_len = len;\n \n-\t\tif (file->is_binary || file->is_unmerged)\n+\t\tif (file->is_unmerged) {\n+\t\t\t/* \"Unmerged\" is 8 characters */\n+\t\t\tbin_width = bin_width < 8 ? 8 : bin_width;\n \t\t\tcontinue;\n+\t\t}\n+\t\tif (file->is_binary) {\n+\t\t\t/* \"Bin XXX -> YYY bytes\" */\n+\t\t\tint w = 14 + decimal_width(file->added)\n+\t\t\t\t+ decimal_width(file->deleted);\n+\t\t\tbin_width = bin_width < w ? w : bin_width;\n+\t\t\t/* Display change counts aligned with \"Bin\" */\n+\t\t\tnumber_width = 3;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tif (max_change < change)\n \t\t\tmax_change = change;\n \t}\n@@ -1437,12 +1450,22 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\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+\t * Binary files are displayed with \"Bin XXX -> YYY bytes\"\n+\t * instead of the change count and graph. This part is treated\n+\t * similarly to the graph part, except that it is not\n+\t * \"scaled\". If total width is too small to accomodate the\n+\t * guaranteed minimum width of the filename part and the\n+\t * separators and this message, this message will \"overflow\"\n+\t * making the line longer than the maximum width.\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+\tnumber_width = decimal_width(max_change) > number_width ?\n+\t\tdecimal_width(max_change) : number_width;\n \n \t/*\n \t * Guarantee 3/8*16==6 for the graph part\n@@ -1453,8 +1476,12 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \n \t/*\n \t * First assign sizes that are wanted, ignoring available width.\n+\t * strlen(\"Bin XXX -> YYY bytes\") == bin_width, and the part\n+\t * starting from \"XXX\" should fit in graph_width.\n \t */\n-\tgraph_width = max_change < 40 ? max_change : 40;\n+\tgraph_width = max_change + 4 > bin_width ? max_change : bin_width - 4;\n+\tif (graph_width > 40)\n+\t\tgraph_width = 40;\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@@ -1508,7 +1535,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\tif (data->files[i]->is_binary) {\n \t\t\tfprintf(options->file, \"%s\", line_prefix);\n \t\t\tshow_name(options->file, prefix, name, len);\n-\t\t\tfprintf(options->file, \"  Bin \");\n+\t\t\tfprintf(options->file, \" %*s \", number_width, \"Bin\");\n \t\t\tfprintf(options->file, \"%s%\"PRIuMAX\"%s\",\n \t\t\t\tdel_c, deleted, reset);\n \t\t\tfprintf(options->file, \" -> \");\n@@ -1521,7 +1548,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\telse if (data->files[i]->is_unmerged) {\n \t\t\tfprintf(options->file, \"%s\", line_prefix);\n \t\t\tshow_name(options->file, prefix, name, len);\n-\t\t\tfprintf(options->file, \"  Unmerged\\n\");\n+\t\t\tfprintf(options->file, \" Unmerged\\n\");\n \t\t\tcontinue;\n \t\t}\n \n@@ -1550,8 +1577,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\t}\n \t\tfprintf(options->file, \"%s\", line_prefix);\n \t\tshow_name(options->file, prefix, name, len);\n-\t\tfprintf(options->file, \"%5\"PRIuMAX\"%s\", added + deleted,\n-\t\t\t\tadded + deleted ? \" \" : \"\");\n+\t\tfprintf(options->file, \" %*\"PRIuMAX\"%s\",\n+\t\t\tnumber_width, added + deleted,\n+\t\t\tadded + deleted ? \" \" : \"\");\n \t\tshow_graph(options->file, '+', add, add_c, reset);\n \t\tshow_graph(options->file, '-', del, del_c, reset);\n \t\tfprintf(options->file, \"\\n\");\ndiff --git t/t0023-crlf-am.sh t/t0023-crlf-am.sh\nindex aaed725..f9bbb91 100755\n--- t/t0023-crlf-am.sh\n+++ t/t0023-crlf-am.sh\n@@ -11,7 +11,7 @@ Date: Thu, 23 Aug 2007 13:00:00 +0200\n Subject: test1\n \n ---\n- foo |    1 +\n+ foo | 1 +\n  1 files changed, 1 insertions(+), 0 deletions(-)\n  create mode 100644 foo\n \ndiff --git t/t1200-tutorial.sh t/t1200-tutorial.sh\nindex 9356bea..397ccb6 100755\n--- t/t1200-tutorial.sh\n+++ t/t1200-tutorial.sh\n@@ -154,8 +154,8 @@ test_expect_success 'git show-branch' '\n cat > resolve.expect << EOF\n Updating VARIABLE..VARIABLE\n FASTFORWARD (no commit created; -m option ignored)\n- example |    1 +\n- hello   |    1 +\n+ example | 1 +\n+ hello   | 1 +\n  2 files changed, 2 insertions(+)\n EOF\n \ndiff --git t/t3404-rebase-interactive.sh t/t3404-rebase-interactive.sh\nindex b981572..c8fe1a9 100755\n--- t/t3404-rebase-interactive.sh\n+++ t/t3404-rebase-interactive.sh\n@@ -323,7 +323,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '\n \techo resolved > file1 &&\n \tgit add file1 &&\n \tgit rebase --continue > output &&\n-\tgrep \"^ file1 |    2 +-$\" output\n+\tgrep \"^ file1 | 2 +-$\" output\n '\n \n test_expect_success 'multi-squash only fires up editor once' '\ndiff --git t/t3903-stash.sh t/t3903-stash.sh\nindex 663c60a..9b83c28 100755\n--- t/t3903-stash.sh\n+++ t/t3903-stash.sh\n@@ -443,7 +443,7 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tcat >expected <<-EOF &&\n-\t file |    1 +\n+\t file | 1 +\n \t 1 file changed, 1 insertion(+)\n \tEOF\n \tgit stash show ${STASH_ID} >actual &&\n@@ -481,7 +481,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tcat >expected <<-EOF &&\n-\t file |    1 +\n+\t file | 1 +\n \t 1 file changed, 1 insertion(+)\n \tEOF\n \tgit stash show ${STASH_ID} >actual &&\ndiff --git t/t4012-diff-binary.sh t/t4012-diff-binary.sh\nindex 2d9f9a0..9dd48bb 100755\n--- t/t4012-diff-binary.sh\n+++ t/t4012-diff-binary.sh\n@@ -90,4 +90,23 @@ test_expect_success 'diff --no-index with binary creation' '\n \ttest_cmp expected actual\n '\n \n+cat >expect <<EOF\n+ binfile  |   Bin 0 -> 1026 bytes\n+ textfile | 10000 ++++++++++++++++++++++++++++++++++++++++\n+EOF\n+\n+test_expect_success 'diff --stat with binary files and big change count' '\n+\techo X | dd of=binfile bs=1k seek=1 &&\n+\tgit add binfile &&\n+\ti=0 &&\n+\twhile test $i -lt 10000; do\n+\t\techo $i &&\n+\t\ti=$(($i + 1))\n+\tdone >textfile &&\n+\tgit add textfile &&\n+\tgit diff --cached --stat binfile textfile >output &&\n+\tgrep \" | \" output >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\ndiff --git t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master\nindex 2f8560c..9951e36 100644\n--- t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master\n+++ t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master\n@@ -1,7 +1,7 @@\n $ git diff-tree --cc --patch-with-stat --summary master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\ndiff --git t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side\nindex 72e03c1..cec33fa 100644\n--- t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side\n+++ t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side\n@@ -1,8 +1,8 @@\n $ git diff-tree --cc --patch-with-stat --summary side\n c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.diff-tree_--cc_--patch-with-stat_master t/t4013/diff.diff-tree_--cc_--patch-with-stat_master\nindex 8b357d9..db3c0a7 100644\n--- t/t4013/diff.diff-tree_--cc_--patch-with-stat_master\n+++ t/t4013/diff.diff-tree_--cc_--patch-with-stat_master\n@@ -1,7 +1,7 @@\n $ git diff-tree --cc --patch-with-stat master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\ndiff --git t/t4013/diff.diff-tree_--cc_--stat_--summary_master t/t4013/diff.diff-tree_--cc_--stat_--summary_master\nindex e0568d6..d019867 100644\n--- t/t4013/diff.diff-tree_--cc_--stat_--summary_master\n+++ t/t4013/diff.diff-tree_--cc_--stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git diff-tree --cc --stat --summary master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git t/t4013/diff.diff-tree_--cc_--stat_--summary_side t/t4013/diff.diff-tree_--cc_--stat_--summary_side\nindex 5afc823..12b2eee 100644\n--- t/t4013/diff.diff-tree_--cc_--stat_--summary_side\n+++ t/t4013/diff.diff-tree_--cc_--stat_--summary_side\n@@ -1,8 +1,8 @@\n $ git diff-tree --cc --stat --summary side\n c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n $\ndiff --git t/t4013/diff.diff-tree_--cc_--stat_master t/t4013/diff.diff-tree_--cc_--stat_master\nindex f48367a..40b9179 100644\n--- t/t4013/diff.diff-tree_--cc_--stat_master\n+++ t/t4013/diff.diff-tree_--cc_--stat_master\n@@ -1,6 +1,6 @@\n $ git diff-tree --cc --stat master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial\nindex 590864c..817ed06 100644\n--- t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial\n+++ t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial\n@@ -1,8 +1,8 @@\n $ git diff-tree --pretty=oneline --root --patch-with-stat initial\n 444ac553ac7612cc88969031b02b3767fb8a353a Initial\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side\nindex e05e778..fe3f6b7 100644\n--- t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side\n+++ t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial\nindex 0e2c956..06eb77e 100644\n--- t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial\n+++ t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial\nindex 384fa44..680eab5 100644\n--- t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial\n+++ t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git t/t4013/diff.diff-tree_--pretty_--root_--stat_initial t/t4013/diff.diff-tree_--pretty_--root_--stat_initial\nindex 10384a8..9722d1b 100644\n--- t/t4013/diff.diff-tree_--pretty_--root_--stat_initial\n+++ t/t4013/diff.diff-tree_--pretty_--root_--stat_initial\n@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n $\ndiff --git t/t4013/diff.diff-tree_--root_--patch-with-stat_initial t/t4013/diff.diff-tree_--root_--patch-with-stat_initial\nindex f57062e..ad69ffe 100644\n--- t/t4013/diff.diff-tree_--root_--patch-with-stat_initial\n+++ t/t4013/diff.diff-tree_--root_--patch-with-stat_initial\n@@ -1,8 +1,8 @@\n $ git diff-tree --root --patch-with-stat initial\n 444ac553ac7612cc88969031b02b3767fb8a353a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.diff-tree_-c_--stat_--summary_master t/t4013/diff.diff-tree_-c_--stat_--summary_master\nindex 7088683..81c3021 100644\n--- t/t4013/diff.diff-tree_-c_--stat_--summary_master\n+++ t/t4013/diff.diff-tree_-c_--stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git diff-tree -c --stat --summary master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git t/t4013/diff.diff-tree_-c_--stat_--summary_side t/t4013/diff.diff-tree_-c_--stat_--summary_side\nindex ef216ab..e8dc12b 100644\n--- t/t4013/diff.diff-tree_-c_--stat_--summary_side\n+++ t/t4013/diff.diff-tree_-c_--stat_--summary_side\n@@ -1,8 +1,8 @@\n $ git diff-tree -c --stat --summary side\n c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n $\ndiff --git t/t4013/diff.diff-tree_-c_--stat_master t/t4013/diff.diff-tree_-c_--stat_master\nindex ad19f10..89d59b1 100644\n--- t/t4013/diff.diff-tree_-c_--stat_master\n+++ t/t4013/diff.diff-tree_-c_--stat_master\n@@ -1,6 +1,6 @@\n $ git diff-tree -c --stat master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git t/t4013/diff.diff_--patch-with-stat_-r_initial..side t/t4013/diff.diff_--patch-with-stat_-r_initial..side\nindex ddad917..be8d1ea 100644\n--- t/t4013/diff.diff_--patch-with-stat_-r_initial..side\n+++ t/t4013/diff.diff_--patch-with-stat_-r_initial..side\n@@ -1,7 +1,7 @@\n $ git diff --patch-with-stat -r initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.diff_--patch-with-stat_initial..side t/t4013/diff.diff_--patch-with-stat_initial..side\nindex bdbd114..5424e6d 100644\n--- t/t4013/diff.diff_--patch-with-stat_initial..side\n+++ t/t4013/diff.diff_--patch-with-stat_initial..side\n@@ -1,7 +1,7 @@\n $ git diff --patch-with-stat initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.diff_--stat_initial..side t/t4013/diff.diff_--stat_initial..side\nindex 6d08f3d..b7741e2 100644\n--- t/t4013/diff.diff_--stat_initial..side\n+++ t/t4013/diff.diff_--stat_initial..side\n@@ -1,6 +1,6 @@\n $ git diff --stat initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n $\ndiff --git t/t4013/diff.diff_-r_--stat_initial..side t/t4013/diff.diff_-r_--stat_initial..side\nindex 2ddb254..5d514f5 100644\n--- t/t4013/diff.diff_-r_--stat_initial..side\n+++ t/t4013/diff.diff_-r_--stat_initial..side\n@@ -1,6 +1,6 @@\n $ git diff -r --stat initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n $\ndiff --git t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side\nindex 3cab049..547ca06 100644\n--- t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side\n+++ t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side\n@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--attach_--stdout_initial..master t/t4013/diff.format-patch_--attach_--stdout_initial..master\nindex 564a4d3..52fedc1 100644\n--- t/t4013/diff.format-patch_--attach_--stdout_initial..master\n+++ t/t4013/diff.format-patch_--attach_--stdout_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--attach_--stdout_initial..master^ t/t4013/diff.format-patch_--attach_--stdout_initial..master^\nindex 4f28460..1c3cde2 100644\n--- t/t4013/diff.format-patch_--attach_--stdout_initial..master^\n+++ t/t4013/diff.format-patch_--attach_--stdout_initial..master^\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git t/t4013/diff.format-patch_--attach_--stdout_initial..side t/t4013/diff.format-patch_--attach_--stdout_initial..side\nindex b10cc2e..4717bd8 100644\n--- t/t4013/diff.format-patch_--attach_--stdout_initial..side\n+++ t/t4013/diff.format-patch_--attach_--stdout_initial..side\n@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master\nindex a976a8a..02c4db7 100644\n--- t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master\n+++ t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master\nindex b4fd664..c7677c5 100644\n--- t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master\n+++ t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--inline_--stdout_initial..master t/t4013/diff.format-patch_--inline_--stdout_initial..master\nindex 0d31036..5b3e34e 100644\n--- t/t4013/diff.format-patch_--inline_--stdout_initial..master\n+++ t/t4013/diff.format-patch_--inline_--stdout_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--inline_--stdout_initial..master^ t/t4013/diff.format-patch_--inline_--stdout_initial..master^\nindex 18d4714..d13f8a8 100644\n--- t/t4013/diff.format-patch_--inline_--stdout_initial..master^\n+++ t/t4013/diff.format-patch_--inline_--stdout_initial..master^\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\nindex 29e00ab..caec553 100644\n--- t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\n+++ t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \ndiff --git t/t4013/diff.format-patch_--inline_--stdout_initial..side t/t4013/diff.format-patch_--inline_--stdout_initial..side\nindex 3572f20..d3a6762 100644\n--- t/t4013/diff.format-patch_--inline_--stdout_initial..side\n+++ t/t4013/diff.format-patch_--inline_--stdout_initial..side\n@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^ t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\nindex 54cdcda..244d964 100644\n--- t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n+++ t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n@@ -10,10 +10,10 @@ A U Thor (2):\n   Second\n   Third\n \n- dir/sub |    4 ++++\n- file0   |    3 +++\n- file1   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 4 ++++\n+ file0   | 3 +++\n+ file1   | 3 +++\n+ file2   | 3 ---\n  4 files changed, 10 insertions(+), 3 deletions(-)\n  create mode 100644 file1\n  delete mode 100644 file2\n@@ -28,9 +28,9 @@ Subject: [DIFFERENT_PREFIX 1/2] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [DIFFERENT_PREFIX 2/2] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master\nindex 23194eb..bfc287a 100644\n--- t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master\n+++ t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master\n@@ -6,9 +6,9 @@ Subject: [PATCH] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--stdout_--numbered_initial..master t/t4013/diff.format-patch_--stdout_--numbered_initial..master\nindex 78f1a80..568f6f5 100644\n--- t/t4013/diff.format-patch_--stdout_--numbered_initial..master\n+++ t/t4013/diff.format-patch_--stdout_--numbered_initial..master\n@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH 2/3] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH 3/3] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--stdout_initial..master t/t4013/diff.format-patch_--stdout_initial..master\nindex a3dab7f..5f0352f 100644\n--- t/t4013/diff.format-patch_--stdout_initial..master\n+++ t/t4013/diff.format-patch_--stdout_initial..master\n@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH 2/3] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH 3/3] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.format-patch_--stdout_initial..master^ t/t4013/diff.format-patch_--stdout_initial..master^\nindex 39f4a3f..2ae454d 100644\n--- t/t4013/diff.format-patch_--stdout_initial..master^\n+++ t/t4013/diff.format-patch_--stdout_initial..master^\n@@ -6,9 +6,9 @@ Subject: [PATCH 1/2] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH 2/2] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git t/t4013/diff.format-patch_--stdout_initial..side t/t4013/diff.format-patch_--stdout_initial..side\nindex 8810920..a7d52fb 100644\n--- t/t4013/diff.format-patch_--stdout_initial..side\n+++ t/t4013/diff.format-patch_--stdout_initial..side\n@@ -5,9 +5,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\nindex 4085bbd..a18f147 100644\n--- t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\n+++ t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\n@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.log_--patch-with-stat_master t/t4013/diff.log_--patch-with-stat_master\nindex 4586279..ae425c4 100644\n--- t/t4013/diff.log_--patch-with-stat_master\n+++ t/t4013/diff.log_--patch-with-stat_master\n@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.log_--patch-with-stat_master_--_dir_ t/t4013/diff.log_--patch-with-stat_master_--_dir_\nindex 6e172cf..d5207ca 100644\n--- t/t4013/diff.log_--patch-with-stat_master_--_dir_\n+++ t/t4013/diff.log_--patch-with-stat_master_--_dir_\n@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\nindex 48b0d4b..0fc1e8c 100644\n--- t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\n+++ t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git t/t4013/diff.log_--root_--patch-with-stat_--summary_master t/t4013/diff.log_--root_--patch-with-stat_--summary_master\nindex f9dc512..dffc09d 100644\n--- t/t4013/diff.log_--root_--patch-with-stat_--summary_master\n+++ t/t4013/diff.log_--root_--patch-with-stat_--summary_master\n@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -55,8 +55,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -88,9 +88,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -130,9 +130,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git t/t4013/diff.log_--root_--patch-with-stat_master t/t4013/diff.log_--root_--patch-with-stat_master\nindex 0807ece..55aa980 100644\n--- t/t4013/diff.log_--root_--patch-with-stat_master\n+++ t/t4013/diff.log_--root_--patch-with-stat_master\n@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\n@@ -127,9 +127,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\nindex 84f5ef6..019d85f 100644\n--- t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\n+++ t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --combined dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git t/t4013/diff.show_--patch-with-stat_--summary_side t/t4013/diff.show_--patch-with-stat_--summary_side\nindex e60384d..95a474e 100644\n--- t/t4013/diff.show_--patch-with-stat_--summary_side\n+++ t/t4013/diff.show_--patch-with-stat_--summary_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git t/t4013/diff.show_--patch-with-stat_side t/t4013/diff.show_--patch-with-stat_side\nindex a3a3255..974e99b 100644\n--- t/t4013/diff.show_--patch-with-stat_side\n+++ t/t4013/diff.show_--patch-with-stat_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.show_--stat_--summary_side t/t4013/diff.show_--stat_--summary_side\nindex d16f464..a71492f 100644\n--- t/t4013/diff.show_--stat_--summary_side\n+++ t/t4013/diff.show_--stat_--summary_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n $\ndiff --git t/t4013/diff.show_--stat_side t/t4013/diff.show_--stat_side\nindex 6300c05..9be7124 100644\n--- t/t4013/diff.show_--stat_side\n+++ t/t4013/diff.show_--stat_side\n@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n $\ndiff --git t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_\nindex 16ae543..c8b6af2 100644\n--- t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_\n+++ t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_\n@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.whatchanged_--patch-with-stat_master t/t4013/diff.whatchanged_--patch-with-stat_master\nindex f3e45ec..1ac431b 100644\n--- t/t4013/diff.whatchanged_--patch-with-stat_master\n+++ t/t4013/diff.whatchanged_--patch-with-stat_master\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_\nindex c77f0bc..b30c285 100644\n--- t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_\n+++ t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_\n@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\nindex 8d03efe..30aae78 100644\n--- t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\n+++ t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master\nindex 1874d06..db90e51 100644\n--- t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master\n+++ t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -48,8 +48,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -81,9 +81,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -123,9 +123,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git t/t4013/diff.whatchanged_--root_--patch-with-stat_master t/t4013/diff.whatchanged_--root_--patch-with-stat_master\nindex 5211ff2..9a6cc92 100644\n--- t/t4013/diff.whatchanged_--root_--patch-with-stat_master\n+++ t/t4013/diff.whatchanged_--root_--patch-with-stat_master\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\nindex ad30245..d1d32bd 100644\n--- t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\n+++ t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --combined dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git t/t4014-format-patch.sh t/t4014-format-patch.sh\nindex 7dfe716..3cfa960 100755\n--- t/t4014-format-patch.sh\n+++ t/t4014-format-patch.sh\n@@ -519,7 +519,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '\n \n cat > expect << EOF\n ---\n- file |   16 ++++++++++++++++\n+ file | 16 ++++++++++++++++\n  1 file changed, 16 insertions(+)\n \n diff --git a/file b/file\ndiff --git t/t4016-diff-quote.sh t/t4016-diff-quote.sh\nindex ab0c2f0..e451f2a 100755\n--- t/t4016-diff-quote.sh\n+++ t/t4016-diff-quote.sh\n@@ -59,13 +59,13 @@ test_expect_success TABS_IN_FILENAMES 'git diff --summary -M HEAD' '\n \n test_expect_success TABS_IN_FILENAMES 'setup expected files' '\n cat >expect <<\\EOF\n- pathname.1 => \"Rpathname\\twith HT.0\"            |    0\n- pathname.3 => \"Rpathname\\nwith LF.0\"            |    0\n- \"pathname\\twith HT.3\" => \"Rpathname\\nwith LF.1\" |    0\n- pathname.2 => Rpathname with SP.0               |    0\n- \"pathname\\twith HT.2\" => Rpathname with SP.1    |    0\n- pathname.0 => Rpathname.0                       |    0\n- \"pathname\\twith HT.0\" => Rpathname.1            |    0\n+ pathname.1 => \"Rpathname\\twith HT.0\"            | 0\n+ pathname.3 => \"Rpathname\\nwith LF.0\"            | 0\n+ \"pathname\\twith HT.3\" => \"Rpathname\\nwith LF.1\" | 0\n+ pathname.2 => Rpathname with SP.0               | 0\n+ \"pathname\\twith HT.2\" => Rpathname with SP.1    | 0\n+ pathname.0 => Rpathname.0                       | 0\n+ \"pathname\\twith HT.0\" => Rpathname.1            | 0\n  7 files changed, 0 insertions(+), 0 deletions(-)\n EOF\n '\ndiff --git t/t4030-diff-textconv.sh t/t4030-diff-textconv.sh\nindex 4ac162c..bd95f93 100755\n--- t/t4030-diff-textconv.sh\n+++ t/t4030-diff-textconv.sh\n@@ -85,7 +85,7 @@ test_expect_success 'status -v produces text' '\n '\n \n cat >expect.stat <<'EOF'\n- file |  Bin 2 -> 4 bytes\n+ file | Bin 2 -> 4 bytes\n  1 file changed, 0 insertions(+), 0 deletions(-)\n EOF\n test_expect_success 'diffstat does not run textconv' '\ndiff --git t/t4043-diff-rename-binary.sh t/t4043-diff-rename-binary.sh\nindex 0601281..ad0b2da 100755\n--- t/t4043-diff-rename-binary.sh\n+++ t/t4043-diff-rename-binary.sh\n@@ -23,8 +23,8 @@ test_expect_success 'move the files into a \"sub\" directory' '\n '\n \n cat > expected <<\\EOF\n- bar => sub/bar |  Bin 5 -> 5 bytes\n- foo => sub/foo |    0\n+ bar => sub/bar | Bin 5 -> 5 bytes\n+ foo => sub/foo |   0\n  2 files changed, 0 insertions(+), 0 deletions(-)\n \n diff --git a/bar b/sub/bar\ndiff --git t/t4045-diff-relative.sh t/t4045-diff-relative.sh\nindex bd119be..ba33578 100755\n--- t/t4045-diff-relative.sh\n+++ t/t4045-diff-relative.sh\n@@ -32,7 +32,7 @@ test_expect_success \"-p $*\" \"\n check_stat() {\n expect=$1; shift\n cat >expected <<EOF\n- $expect |    1 +\n+ $expect | 1 +\n  1 file changed, 1 insertion(+)\n EOF\n test_expect_success \"--stat $*\" \"\ndiff --git t/t4047-diff-dirstat.sh t/t4047-diff-dirstat.sh\nindex 29e80a5..75eaf16 100755\n--- t/t4047-diff-dirstat.sh\n+++ t/t4047-diff-dirstat.sh\n@@ -252,41 +252,41 @@ EOF\n '\n \n cat <<EOF >expect_diff_stat\n- changed/text             |    2 +-\n- dst/copy/changed/text    |   10 ++++++++++\n- dst/copy/rearranged/text |   10 ++++++++++\n- dst/copy/unchanged/text  |   10 ++++++++++\n- dst/move/changed/text    |   10 ++++++++++\n- dst/move/rearranged/text |   10 ++++++++++\n- dst/move/unchanged/text  |   10 ++++++++++\n- rearranged/text          |    2 +-\n- src/move/changed/text    |   10 ----------\n- src/move/rearranged/text |   10 ----------\n- src/move/unchanged/text  |   10 ----------\n+ changed/text             |  2 +-\n+ dst/copy/changed/text    | 10 ++++++++++\n+ dst/copy/rearranged/text | 10 ++++++++++\n+ dst/copy/unchanged/text  | 10 ++++++++++\n+ dst/move/changed/text    | 10 ++++++++++\n+ dst/move/rearranged/text | 10 ++++++++++\n+ dst/move/unchanged/text  | 10 ++++++++++\n+ rearranged/text          |  2 +-\n+ src/move/changed/text    | 10 ----------\n+ src/move/rearranged/text | 10 ----------\n+ src/move/unchanged/text  | 10 ----------\n  11 files changed, 62 insertions(+), 32 deletions(-)\n EOF\n \n cat <<EOF >expect_diff_stat_M\n- changed/text                      |    2 +-\n- dst/copy/changed/text             |   10 ++++++++++\n- dst/copy/rearranged/text          |   10 ++++++++++\n- dst/copy/unchanged/text           |   10 ++++++++++\n- {src => dst}/move/changed/text    |    2 +-\n- {src => dst}/move/rearranged/text |    2 +-\n- {src => dst}/move/unchanged/text  |    0\n- rearranged/text                   |    2 +-\n+ changed/text                      |  2 +-\n+ dst/copy/changed/text             | 10 ++++++++++\n+ dst/copy/rearranged/text          | 10 ++++++++++\n+ dst/copy/unchanged/text           | 10 ++++++++++\n+ {src => dst}/move/changed/text    |  2 +-\n+ {src => dst}/move/rearranged/text |  2 +-\n+ {src => dst}/move/unchanged/text  |  0\n+ rearranged/text                   |  2 +-\n  8 files changed, 34 insertions(+), 4 deletions(-)\n EOF\n \n cat <<EOF >expect_diff_stat_CC\n- changed/text                      |    2 +-\n- {src => dst}/copy/changed/text    |    2 +-\n- {src => dst}/copy/rearranged/text |    2 +-\n- {src => dst}/copy/unchanged/text  |    0\n- {src => dst}/move/changed/text    |    2 +-\n- {src => dst}/move/rearranged/text |    2 +-\n- {src => dst}/move/unchanged/text  |    0\n- rearranged/text                   |    2 +-\n+ changed/text                      | 2 +-\n+ {src => dst}/copy/changed/text    | 2 +-\n+ {src => dst}/copy/rearranged/text | 2 +-\n+ {src => dst}/copy/unchanged/text  | 0\n+ {src => dst}/move/changed/text    | 2 +-\n+ {src => dst}/move/rearranged/text | 2 +-\n+ {src => dst}/move/unchanged/text  | 0\n+ rearranged/text                   | 2 +-\n  8 files changed, 6 insertions(+), 6 deletions(-)\n EOF\n \ndiff --git t/t4049-diff-stat-count.sh t/t4049-diff-stat-count.sh\nindex a6d1887..d7231ee 100755\n--- t/t4049-diff-stat-count.sh\n+++ t/t4049-diff-stat-count.sh\n@@ -14,8 +14,8 @@ test_expect_success setup '\n \techo a >a &&\n \techo b >b &&\n \tcat >expect <<-\\EOF\n-\t a |    1 +\n-\t b |    1 +\n+\t a | 1 +\n+\t b | 1 +\n \t 2 files changed, 2 insertions(+)\n \tEOF\n \tgit diff --stat --stat-count=2 >actual &&\ndiff --git t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex 1b237b7..d670bb0 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -19,11 +19,11 @@ test_expect_success 'preparation' '\n \tgit commit -m message \"$name\"\n '\n cat >expect80 <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n EOF\n \n cat >expect40 <<-'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n EOF\n \n while read cmd args\n@@ -47,13 +47,13 @@ do\n \t'\n \n \ttest_expect_success \"$cmd --stat=...,name-width with long name\" '\n-\t\tgit $cmd $args --stat=60,29 >output &&\n+\t\tgit $cmd $args --stat=60,32 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect40 actual\n \t'\n \n \ttest_expect_success \"$cmd --stat-name-width with long name\" '\n-\t\tgit $cmd $args --stat-name-width=29 >output &&\n+\t\tgit $cmd $args --stat-name-width=32 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect40 actual\n \t'\ndiff --git t/t5100/patch0001 t/t5100/patch0001\nindex 8ce1551..02c9774 100644\n--- t/t5100/patch0001\n+++ t/t5100/patch0001\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git t/t5100/patch0002 t/t5100/patch0002\nindex 8ce1551..02c9774 100644\n--- t/t5100/patch0002\n+++ t/t5100/patch0002\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git t/t5100/patch0003 t/t5100/patch0003\nindex 8ce1551..02c9774 100644\n--- t/t5100/patch0003\n+++ t/t5100/patch0003\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git t/t5100/patch0005 t/t5100/patch0005\nindex 7d24b24..ab7a383 100644\n--- t/t5100/patch0005\n+++ t/t5100/patch0005\n@@ -1,7 +1,7 @@\n ---\n \n- Documentation/git-cvsimport-script.txt |    9 ++++++++-\n- git-cvsimport-script                   |    4 ++--\n+ Documentation/git-cvsimport-script.txt | 9 ++++++++-\n+ git-cvsimport-script                   | 4 ++--\n  2 files changed, 10 insertions(+), 3 deletions(-)\n \n 50452f9c0c2df1f04d83a26266ba704b13861632\ndiff --git t/t5100/patch0006 t/t5100/patch0006\nindex 8ce1551..02c9774 100644\n--- t/t5100/patch0006\n+++ t/t5100/patch0006\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git t/t5100/patch0010 t/t5100/patch0010\nindex f055481..436821c 100644\n--- t/t5100/patch0010\n+++ t/t5100/patch0010\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c |    2 +-\n+ builtin-mailinfo.c | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git t/t5100/patch0011 t/t5100/patch0011\nindex 8841d3c..0988713 100644\n--- t/t5100/patch0011\n+++ t/t5100/patch0011\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c  |    4 ++--\n+ builtin-mailinfo.c  | 4 ++--\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n index 3e5fe51..aabfe5c 100644\ndiff --git t/t5100/patch0014 t/t5100/patch0014\nindex 124efd2..3f3825f 100644\n--- t/t5100/patch0014\n+++ t/t5100/patch0014\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-\n+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-\n  1 files changed, 36 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git t/t5100/patch0014--scissors t/t5100/patch0014--scissors\nindex 124efd2..3f3825f 100644\n--- t/t5100/patch0014--scissors\n+++ t/t5100/patch0014--scissors\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-\n+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-\n  1 files changed, 36 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git t/t5100/sample.mbox t/t5100/sample.mbox\nindex de10312..34a09a0 100644\n--- t/t5100/sample.mbox\n+++ t/t5100/sample.mbox\n@@ -12,7 +12,7 @@ Subject: [PATCH] a commit.\n Here is a patch from A U Thor.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -52,7 +52,7 @@ two truly blank and another full of spaces in between.\n Hope this helps.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -83,7 +83,7 @@ Message-Id: <nitpicker.12121212@example.net>\n Hopefully this would fix the problem stated there.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -249,8 +249,8 @@ actual flags.\n Signed-off-by: David K=E5gedal <davidk@lysator.liu.se>\n ---\n \n- Documentation/git-cvsimport-script.txt |    9 ++++++++-\n- git-cvsimport-script                   |    4 ++--\n+ Documentation/git-cvsimport-script.txt | 9 ++++++++-\n+ git-cvsimport-script                   | 4 ++--\n  2 files changed, 10 insertions(+), 3 deletions(-)\n \n 50452f9c0c2df1f04d83a26266ba704b13861632\n@@ -379,7 +379,7 @@ Subject: [PATCH] a commit.\n Here is a patch from A U Thor.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -449,7 +449,7 @@ memcmp(\"Subject: \", header[i], 7) will never match.\n Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n Signed-off-by: Junio C Hamano <gitster@pobox.com>\n ---\n- builtin-mailinfo.c |    2 +-\n+ builtin-mailinfo.c | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n@@ -482,7 +482,7 @@ Content-Transfer-Encoding: quoted-printable\n Here comes a commit log message, and\n its second line is here.\n ---\n- builtin-mailinfo.c  |    4 ++--\n+ builtin-mailinfo.c  | 4 ++--\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n index 3e5fe51..aabfe5c 100644\n@@ -587,7 +587,7 @@ everything before it in the message body.\n \n Signed-off-by: Junio C Hamano <gitster@pobox.com>\n ---\n- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-\n+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-\n  1 files changed, 36 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git t/t7602-merge-octopus-many.sh t/t7602-merge-octopus-many.sh\nindex 5783ebf..1479b8f 100755\n--- t/t7602-merge-octopus-many.sh\n+++ t/t7602-merge-octopus-many.sh\n@@ -54,9 +54,9 @@ Trying simple merge with c2\n Trying simple merge with c3\n Trying simple merge with c4\n Merge made by the 'octopus' strategy.\n- c2.c |    1 +\n- c3.c |    1 +\n- c4.c |    1 +\n+ c2.c | 1 +\n+ c3.c | 1 +\n+ c4.c | 1 +\n  3 files changed, 3 insertions(+)\n  create mode 100644 c2.c\n  create mode 100644 c3.c\n@@ -73,7 +73,7 @@ cat >expected <<\\EOF\n Already up-to-date with c4\n Trying simple merge with c5\n Merge made by the 'octopus' strategy.\n- c5.c |    1 +\n+ c5.c | 1 +\n  1 file changed, 1 insertion(+)\n  create mode 100644 c5.c\n EOF\n@@ -87,8 +87,8 @@ cat >expected <<\\EOF\n Fast-forwarding to: c1\n Trying simple merge with c2\n Merge made by the 'octopus' strategy.\n- c1.c |    1 +\n- c2.c |    1 +\n+ c1.c | 1 +\n+ c2.c | 1 +\n  2 files changed, 2 insertions(+)\n  create mode 100644 c1.c\n  create mode 100644 c2.c\n-- \n1.7.9.1.353.g684b4\n"},{"id":"185046","messageId":"7v4nuljcnk.fsf@alter.siamese.dyndns.org","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-20T23:41:35Z","receivedAt":"2012-02-20T23:41: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> JC:\n>> Perhaps the maximum for garph_width should be raised to something like\n>> \"min(80, stat_width) - name_width\"?\n> I think that a graph like\n> a | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n> b |    1 -\n> is not very readable. I like the consistency forced by the 40-column limit.\n> But I guess that this is very subjective.\n\nThe above makes it very obvious that there is a huge amount of change made\nto 'a' and a bit of deletion to 'b', compared to a mini-graph that is\ntruncated to half the screen width.\n\nBesides, the above is what you would get without your patch on 80-column\nterminal, no?\n"},{"id":"185048","messageId":"4F42E4C2.7070801@in.waw.pl","threadId":"29675","inReplyTo":"7v4nuljcnk.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-21T00:26:42Z","receivedAt":"2012-02-21T00:26:42Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 02/21/2012 12:41 AM, Junio C Hamano wrote:\n> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:\n>\n>> JC:\n>>> Perhaps the maximum for garph_width should be raised to something like\n>>> \"min(80, stat_width) - name_width\"?\n>> I think that a graph like\n>> a | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>> b |    1 -\n>> is not very readable. I like the consistency forced by the 40-column limit.\n>> But I guess that this is very subjective.\n>\n> The above makes it very obvious that there is a huge amount of change made\n> to 'a' and a bit of deletion to 'b', compared to a mini-graph that is\n> truncated to half the screen width.\nYes. But the same graph with 40 columns tells me exactly the same thing.\nOTOH, if the filenames+graph fill the whole 80 columns, everything is \nnicely aligned wrt. to text above and below. Maybe it should be \nconfigurable after all?\n\n> Besides, the above is what you would get without your patch on 80-column\n> terminal, no?\nYes.\n\nZbyszek\n"},{"id":"185055","messageId":"7vr4xois3l.fsf@alter.siamese.dyndns.org","threadId":"29675","inReplyTo":"4F42E4C2.7070801@in.waw.pl","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-21T07:05:34Z","receivedAt":"2012-02-21T07:05:34Z","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> On 02/21/2012 12:41 AM, Junio C Hamano wrote:\n>> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:\n>>\n>>> JC:\n>>>> Perhaps the maximum for garph_width should be raised to something like\n>>>> \"min(80, stat_width) - name_width\"?\n>>> I think that a graph like\n>>> a | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>>> b |    1 -\n>>> is not very readable. I like the consistency forced by the 40-column limit.\n>>> But I guess that this is very subjective.\n>>\n>> The above makes it very obvious that there is a huge amount of change made\n>> to 'a' and a bit of deletion to 'b', compared to a mini-graph that is\n>> truncated to half the screen width.\n> Yes. But the same graph with 40 columns tells me exactly the same thing.\n\nThat is a bogus argument, isn't it?  You can say the same thing if you\nlimited the length of the graph bars to 10-columns if you only compare\nbetween 1000 and 1. You can even do with just 5-columns.  For that matter,\nwithout any graph bar at all, it tells us exactly the same thing because\nwe have numbers.  Does that mean we do not need any bar?  Of course not.\nWe use bars as visual aid.\n\nImagine what happens to the graph if you had paths with medium amount of\nchanges like 980, 800, 40, in addition to 1000 and 1.  By limiting the\nlength of the bars more than necessary, you are losing the resolution\nwithout a good reason, and that is why I find 40-column limit a poor\ndesign choice.\n\n>> Besides, the above is what you would get without your patch on 80-column\n>> terminal, no?\n>\n> Yes.\n\nI think this \"use at most 40-places for the graph bar\" was your response\nto somebody's observation that \"on 200-column terminal, we will still see\nthe commit log messages (and for many projects, also patch text) that are\ndesigned to be comfortably viewable within the 80-column on the left, and\noverlong graph bar stands out like an ugly sore thumb\".\n\nWhile that \"ugliness\" observation might be a valid one to make, I do not\nthink limiting the length of the graph bar without taking the length of\nthe name part into account at all is the right solution to it.\n\nAfter all, that is exactly the same thinking that led to the bug in the\ncurrent code that you fixed with your series, isn't it?  Our safety code\ntruncated the graph bar width too early without taking the width needed to\nshow the names into account, and then when the names turn out to be all\nshort, we ended up wasting space on the right hand side, because we made\nthe bars too short and the decision was made too early in the code.\n\nIf the problem you are addressing is to make sure that the diffstat part\nin the series of lines that are structured like this:\n\n   log message part ~80 column\n   diff stat part that can extend very very very very very very very long\n   patch text part  ~80 column\n\ndoes not become overly long, wouldn't it be a more natural solution to\nmake sure that when the total (i.e. name and graph) length can fit to\nalign with the message and patch (i.e. traditional ~80 col regardless of\nthe terminal width), not to give it too much width?  If the names are\nshort, like \"a\" and \"b\", that may result in graph bar part to use ~70\ncolumns or so, and if the names are long, like in a Java project, you may\nallocate 50 columns to the name and leave only 50 columns or so for the\ngraph part.\n\nA simple heuristic might be to see if name part (without truncation) and\nthe graph part (without scaling) fits under 100-columns if the terminal is\nwider than that, and if so limit the whole thing to 100-columns before\ndeciding the allocation of the total into two parts.  If the name part\nalone is very wide, showing the name and the graph using the whole\nterminal width would give you a better result than using the bars that are\nartificially capped to a short limit, I would imagine.\n"},{"id":"185068","messageId":"4F436C5D.7070606@in.waw.pl","threadId":"29675","inReplyTo":"7vr4xois3l.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-21T10:05:17Z","receivedAt":"2012-02-21T10:05:17Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 02/21/2012 08:05 AM, Junio C Hamano wrote:\n> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:\n>\n>> On 02/21/2012 12:41 AM, Junio C Hamano wrote:\n>>> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>   writes:\n>>>\n>>>> JC:\n>>>>> Perhaps the maximum for garph_width should be raised to something like\n>>>>> \"min(80, stat_width) - name_width\"?\n>>>> I think that a graph like\n>>>> a | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>>>> b |    1 -\n>>>> is not very readable. I like the consistency forced by the 40-column limit.\n>>>> But I guess that this is very subjective.\n>>>\n>>> The above makes it very obvious that there is a huge amount of change made\n>>> to 'a' and a bit of deletion to 'b', compared to a mini-graph that is\n>>> truncated to half the screen width.\n>> Yes. But the same graph with 40 columns tells me exactly the same thing.\n>\n> That is a bogus argument, isn't it?  You can say the same thing if you\n> limited the length of the graph bars to 10-columns if you only compare\n> between 1000 and 1. You can even do with just 5-columns.  For that matter,\n> without any graph bar at all, it tells us exactly the same thing because\n> we have numbers.  Does that mean we do not need any bar?  Of course not.\n> We use bars as visual aid.\nYes.\n\n> Imagine what happens to the graph if you had paths with medium amount of\n> changes like 980, 800, 40, in addition to 1000 and 1.  By limiting the\n> length of the bars more than necessary, you are losing the resolution\n> without a good reason, and that is why I find 40-column limit a poor\n> design choice.\nYou're right.\n\n>>> Besides, the above is what you would get without your patch on 80-column\n>>> terminal, no?\n>>\n>> Yes.\n>\n> I think this \"use at most 40-places for the graph bar\" was your response\n> to somebody's observation that \"on 200-column terminal, we will still see\n> the commit log messages (and for many projects, also patch text) that are\n> designed to be comfortably viewable within the 80-column on the left, and\n> overlong graph bar stands out like an ugly sore thumb\".\n>\n> While that \"ugliness\" observation might be a valid one to make, I do not\n> think limiting the length of the graph bar without taking the length of\n> the name part into account at all is the right solution to it.\n>\n> After all, that is exactly the same thinking that led to the bug in the\n> current code that you fixed with your series, isn't it?  Our safety code\n> truncated the graph bar width too early without taking the width needed to\n> show the names into account, and then when the names turn out to be all\n> short, we ended up wasting space on the right hand side, because we made\n> the bars too short and the decision was made too early in the code.\n>\n> If the problem you are addressing is to make sure that the diffstat part\n> in the series of lines that are structured like this:\n>\n>     log message part ~80 column\n>     diff stat part that can extend very very very very very very very long\n>     patch text part  ~80 column\n>\n> does not become overly long, wouldn't it be a more natural solution to\n> make sure that when the total (i.e. name and graph) length can fit to\n> align with the message and patch (i.e. traditional ~80 col regardless of\n> the terminal width), not to give it too much width?  If the names are\n> short, like \"a\" and \"b\", that may result in graph bar part to use ~70\n> columns or so, and if the names are long, like in a Java project, you may\n> allocate 50 columns to the name and leave only 50 columns or so for the\n> graph part.\n>\n> A simple heuristic might be to see if name part (without truncation) and\n> the graph part (without scaling) fits under 100-columns if the terminal is\n> wider than that, and if so limit the whole thing to 100-columns before\n> deciding the allocation of the total into two parts.  If the name part\n> alone is very wide, showing the name and the graph using the whole\n> terminal width would give you a better result than using the bars that are\n> artificially capped to a short limit, I would imagine.\nThis seem overly complex. A nice property to have would be\n\"if the window is wide enough so there's enough space for full \nfilenames, the graph part scales monotonically with the change count\".\n(If there's filename truncation, than there just isn't enough space for \neverything and the graph may be compressed. But otherwise, if we have \ntwo graphs which do not end at the edge of the screen, and the second \none is wider than the first one, then without looking at the change \ncounts we know that the second one has more changes).\n\nFor this property to be satisfied, the graph_width limit would have to \nbe independent of the filename width. So maybe it should be\n   71 = (available space if stat_width==80 and the filename is \"a\" and\n         the change count is in double digits).\nThen if the filenames are longer, and the change counts are big enough,\nthe graph part starts gently extending above 80 columns.\n\nWhat do you think about this approach?\n\nZbyszek\n"},{"id":"185082","messageId":"CACsJy8AXH6xm-ShH_HF6RwATFwsYtAZQfcWoB9VpaiCMj6e8vQ@mail.gmail.com","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-21T15:16:39Z","receivedAt":"2012-02-21T15:16:39Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Not related to changes in the series, but on the same topic. Have you\nconsidered grouping pathnames to reduce pressure on truncating them?\nInstead of showing\n\na/b/c | ++--\na/b/d | --++\n\nyou could show\n\na/b:\nc | ++--\nd | --++\n\nOptimal grouping strategy could be hard, but at least we could use it\nfor the case \"git diff --stat -- one/path/deep/in/here\"\n-- \nDuy\n"},{"id":"185085","messageId":"4F43C23C.8070304@in.waw.pl","threadId":"29675","inReplyTo":"CACsJy8AXH6xm-ShH_HF6RwATFwsYtAZQfcWoB9VpaiCMj6e8vQ@mail.gmail.com","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-21T16:11:40Z","receivedAt":"2012-02-21T16:11:40Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 02/21/2012 04:16 PM, Nguyen Thai Ngoc Duy wrote:\n> Not related to changes in the series, but on the same topic. Have you\n> considered grouping pathnames to reduce pressure on truncating them?\n> Instead of showing\n>\n> a/b/c | ++--\n> a/b/d | --++\n>\n> you could show\n>\n> a/b:\n> c | ++--\n> d | --++\n>\n> Optimal grouping strategy could be hard, but at least we could use it\n> for the case \"git diff --stat -- one/path/deep/in/here\"\nI use (or would like to be able to use) the --stat output to select with \nthe mouse and paste into something like\n   emacsclient -n <pathname>\nThis would be harder with the grouping, because I'd have to select two \nparts and paste two times and type a slash. So for me this would be a minus.\n\nAlso, I'm not sure about grouping if there's more than one group. The \ngraph wouldn't be as readable. But if there's only one group, i.e. if \nall filenames have a common prefix ending in a slash, like in your \nexample, this could be useful.\n\nZbyszek\n"},{"id":"185097","messageId":"7v1upogd6w.fsf@alter.siamese.dyndns.org","threadId":"29675","inReplyTo":"4F436C5D.7070606@in.waw.pl","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-21T20:10:31Z","receivedAt":"2012-02-21T20:10:31Z","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> This seem overly complex. A nice property to have would be\n> \"if the window is wide enough so there's enough space for full\n> filenames, the graph part scales monotonically with the change count\".\n> (If there's filename truncation, than there just isn't enough space\n> for everything and the graph may be compressed. But otherwise, if we\n> have two graphs which do not end at the edge of the screen, and the\n> second one is wider than the first one, then without looking at the\n> change counts we know that the second one has more changes).\n>\n> For this property to be satisfied, the graph_width limit would have to\n> be independent of the filename width.\n>\n> So maybe it should be ...\n\nSorry, the desired property I would understand, but that does not click\nwith your \"have to be independent\" conclusion, so I do not have comment on\nthe \"maybe it should be...\" part.\n\nThe resolution requirement may want to set a \"desired lower limit\" for the\nwidth of the graph, but it is only \"desired\" because it is possible that\nyou have to bust the limit if you have three files with 1, 9999 and 10000\nchanged lines and your terminal is only 200 columns wide.\n\nThe current code caps name part to 50/80, but allows the graph to use more\nwhen you have only shorter names.  Perhaps you can follow the same logic\nin the first part of your [7/8] (which needs to be separated to at least\nin two pieces, as it conflates the \"lift 50-column cap from the name width\nand make it proportional to the term_width()\" part and \"but cap the graph\npart to 40-column\" part, that are separate topics)?  Then we can try\ndifferent heuristics to find a better way to cap the length of the graph\non top?\n"},{"id":"185166","messageId":"4F44D084.7030308@in.waw.pl","threadId":"29675","inReplyTo":"7v1upogd6w.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-22T11:24:52Z","receivedAt":"2012-02-22T11:24:52Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"On 02/21/2012 09:10 PM, Junio C Hamano wrote:\n> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:\n>\n>> This seem overly complex. A nice property to have would be\n>> \"if the window is wide enough so there's enough space for full\n>> filenames, the graph part scales monotonically with the change count\".\n>> (If there's filename truncation, than there just isn't enough space\n>> for everything and the graph may be compressed. But otherwise, if we\n>> have two graphs which do not end at the edge of the screen, and the\n>> second one is wider than the first one, then without looking at the\n>> change counts we know that the second one has more changes).\n>>\n>> For this property to be satisfied, the graph_width limit would have to\n>> be independent of the filename width.\n>>\n>> So maybe it should be ...\n>\n> Sorry, the desired property I would understand, but that does not click\n> with your \"have to be independent\" conclusion, so I do not have comment on\n> the \"maybe it should be...\" part.\nHi,\n\nby \"scales monotonically with the change count\" I meant with two \ndifferent commits. Image that there are two commits\n   a | 300 ++++++++++++++++++++++\nand\n   a/a/a/b | 300 ++++++++++++++++++++++\nBoth commits have the same change count, but filenames of different \nlength. If the filename length can influence the number of \"+\" in the \ngraph, then the scaling is not monotonic. There would always be cases \nwhen a bigger change with longer filenames has a narrower graph.\n\n> The resolution requirement may want to set a \"desired lower limit\" for the\n> width of the graph, but it is only \"desired\" because it is possible that\n> you have to bust the limit if you have three files with 1, 9999 and 10000\n> changed lines and your terminal is only 200 columns wide.\n>\n> The current code caps name part to 50/80, but allows the graph to use more\n> when you have only shorter names.  Perhaps you can follow the same logic\n> in the first part of your [7/8] (which needs to be separated to at least\n> in two pieces, as it conflates the \"lift 50-column cap from the name width\n> and make it proportional to the term_width()\" part and \"but cap the graph\n> part to 40-column\" part, that are separate topics)?  Then we can try\n> different heuristics to find a better way to cap the length of the graph\n> on top?\nSure. I'll be replying to this mail with patches\n  [7.1/8] use a maximum of 5/8 for the filename part\n  [7.2/8] add a test for output with COLUMNS=40\n  [7.3/8] limit graph part to 40 columns\n\n--\nZbyszek\n"},{"id":"185170","messageId":"1329911507-10587-1-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"4F44D084.7030308@in.waw.pl","subject":"[PATCH 7.1/8] diff --stat: use a maximum of 5/8 for the filename part","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-22T11:51:44Z","receivedAt":"2012-02-22T11:51:44Z","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 t4052 that fixes a\nfew tests marked with test_expect_failure.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n Documentation/diff-options.txt | 14 ++++---\n diff.c                         | 90 ++++++++++++++++++++++++++--------------\n t/t4052-stat-output.sh         | 14 +++----\n 3 files changed, 75 insertions(+), 43 deletions(-)\n\ndiff --git Documentation/diff-options.txt Documentation/diff-options.txt\nindex 9ed78c9..29647e5 100644\n--- Documentation/diff-options.txt\n+++ 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 diff.c diff.c\nindex 1db46a4..f1c278f 100644\n--- diff.c\n+++ diff.c\n@@ -1375,7 +1375,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@@ -1389,28 +1389,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@@ -1431,19 +1418,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@@ -1499,18 +1529,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 t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex 2b4510c..c250744 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -28,19 +28,19 @@ EOF\n \n while read cmd args\n do\n-\ttest_expect_failure \"$cmd graph width defaults to 80 columns\" '\n+\ttest_expect_success \"$cmd graph width defaults to 80 columns\" '\n \t\tgit $cmd $args >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect80 actual\n \t'\n \n-\ttest_expect_failure \"$cmd --stat=width with long name\" '\n+\ttest_expect_success \"$cmd --stat=width with long name\" '\n \t\tgit $cmd $args --stat=40 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect40 actual\n \t'\n \n-\ttest_expect_failure \"$cmd --stat-width=width with long name\" '\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 expect40 actual\n@@ -87,7 +87,7 @@ EOF\n \n while read verb expect cmd args\n do\n-\ttest_expect_success \"$cmd $verb COLUMNS (big change)\" '\n+\ttest_expect_success \"$cmd $verb too many COLUMNS (big change)\" '\n \t\tCOLUMNS=200 git $cmd $args >output\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp \"$expect\" actual\n@@ -130,7 +130,7 @@ test_expect_success 'preparation for long filename tests' '\n '\n \n cat >expect <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++\n EOF\n \n while read cmd args\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.1.355.ge8a9f\n"},{"id":"185169","messageId":"1329911507-10587-2-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329911507-10587-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 7.2/8] diff --stat: add a test for output with COLUMNS=40","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-22T11:51:45Z","receivedAt":"2012-02-22T11:51:45Z","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>\n---\n t/t4052-stat-output.sh | 19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)\n\ndiff --git t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex c250744..84be8bd 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -99,6 +99,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.1.355.ge8a9f\n"},{"id":"185168","messageId":"1329911507-10587-3-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1329911507-10587-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH 7.3/8] diff --stat: limit graph part to 40 columns","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-22T11:51:46Z","receivedAt":"2012-02-22T11:51:46Z","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 up to 40 columns 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 would use the full\nwidth, the output would look bad. Messages wrapped to about 80 columns\nwould be interspersed with very long +- lines. It makes sense to limit\nthe width of the graph part to a fixed value, even if more columns are\navailable. This fixed value is subjectively hard-coded to be 40\ncolumns, which seems to work well for git.git and linux-2.6.git and\nsome other repositories.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n Documentation/diff-options.txt |  2 +-\n diff.c                         |  8 ++++++--\n t/t4052-stat-output.sh         | 16 ++++++----------\n 3 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git Documentation/diff-options.txt Documentation/diff-options.txt\nindex 29647e5..e4d0e3e 100644\n--- Documentation/diff-options.txt\n+++ Documentation/diff-options.txt\n@@ -54,7 +54,7 @@ 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+\twill be used for the filename part, and up to 40 columns 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\ndiff --git diff.c diff.c\nindex f1c278f..8a9a387 100644\n--- diff.c\n+++ diff.c\n@@ -1421,13 +1421,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, 40) 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 40 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@@ -1452,7 +1454,7 @@ 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 = max_change < 40 ? max_change : 40;\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@@ -1463,6 +1465,8 @@ 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 (graph_width > 40)\n+\t\t\tgraph_width =  40;\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\ndiff --git t/t4052-stat-output.sh t/t4052-stat-output.sh\nindex 84be8bd..1b237b7 100755\n--- t/t4052-stat-output.sh\n+++ t/t4052-stat-output.sh\n@@ -78,11 +78,7 @@ test_expect_success 'preparation for big change tests' '\n '\n \n cat >expect80 <<'EOF'\n- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n-EOF\n-\n-cat >expect200 <<'EOF'\n- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++\n EOF\n \n while read verb expect cmd args\n@@ -94,9 +90,9 @@ do\n \t'\n done <<\\EOF\n ignores expect80 format-patch -1 --stdout\n-respects expect200 diff HEAD^ HEAD --stat\n-respects expect200 show --stat\n-respects expect200 log -1 --stat\n+respects expect80 diff HEAD^ HEAD --stat\n+respects expect80 show --stat\n+respects expect80 log -1 --stat\n EOF\n \n cat >expect40 <<'EOF'\n@@ -170,7 +166,7 @@ cat >expect80 <<'EOF'\n  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++\n EOF\n cat >expect200 <<'EOF'\n- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++\n EOF\n while read verb expect cmd args\n do\n@@ -187,7 +183,7 @@ 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 respects COLUMNS (big change)' '\n \tgit checkout -b branch HEAD^^ &&\n-- \n1.7.9.1.355.ge8a9f\n"},{"id":"185189","messageId":"7vr4xmac6f.fsf@alter.siamese.dyndns.org","threadId":"29675","inReplyTo":"4F44D084.7030308@in.waw.pl","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-22T19:41:12Z","receivedAt":"2012-02-22T19:41:12Z","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> by \"scales monotonically with the change count\" I meant with two\n> different commits.\n\nBecause of the scaling, the same 300-line change to the same file will be\nshown with different number of +- depending on the amount of change to\nother files in the same commit.  It is not something we should be worried\nabout to begin with, unless you are going to read all commits in advance\nand find necessary length of the name part, and also maxchange across\nthese commits to align things across commits, which of course would not\nmesh well with our desire to stream output whenever possible.\n\n>  [7.3/8] limit graph part to 40 columns\n\nRead the problem you are trying to solve again (from your 3/8):\n\n>> If commits changing a lot of lines are displayed in a wide terminal\n>> window (200 or more columns), and the +- graph would use the full\n>> width, the output would look bad. Messages wrapped to about 80 columns\n>> would be interspersed with very long +- lines.\n\nIf your name part needs only 10-20 columns and you are used to seeing\ngraph bars that are 60-70 columns long on your standard 80-column\nterminal, you may see it ugly if the same short names are followed by\ngraph bars that are 180-190 columns (i.e. \"very long +-\"), when the\nmessages still fit 80 columns on the standard terminal, which is a width\nthat can comfortably be scanned with horizontal movement of human eyes.  I\nwould understand that concern, although I do not personally think it is a\nbig deal.\n\nImagine if your name part were 125 columns wide (200 * 5/8), and also\nimagine you drew the same graph bars as before, i.e. using 60-70 columns.\nThat line will fill almost the full terminal width, and will extend beyond\nthe right edge of the message block, but you are not showing \"very long +-\nlines\" anymore.  The length of the line comes mostly from overly long\nnames, carrying more information than before (because your patch lets us\nshow larger parts of such a long name on wider terminal), and without \nlosing much information from the graph part.\n\nNow imagine if your patch only needed 10-20 columns for the names, and you\nare showing the same change on an 80-column terminal with your 40-column\ncap.  You will introduce a new problem with \"very short +-\" lines instead,\nas the \"diff --stat\" block will be much shorter than the surrounding text.\n\nYou fixed a bug in the original partitioning with 1/8, which was caused by\na code that capped the length of the graph part too early before taking\nthe width necessary to show the name into account; the bug resulted in a\ngraph that did not fill the allotted space fully to the right, even though\nthe user wanted to give full width to the graph.\n\nThe ugliness avoidance against \"very long +-\" becomes an issue only on\nwide terminals; doing the same 40-column cap on non-wide terminals is to\nre-introduce the same \"cap the graph width too early, ending up with a\ngraph that is narrower than desired\" bug you fixed.  Why do you keep\ninsisting on that broken approach?\n\nIt might be just the matter of raising the artificial cap to much higher\nthan 40-column (say, 80-column).  A possible alternative may be to declare\nthat the perceived ugliness is the user's problem of having overly wide\nterminal in the first place and do without any such cap.\n\nEither is fine, but regressing output on 80-column terminal when showing a\npatch with short filenames and large changes is unacceptable, not because\nI personally use 80-col terminal myself (I don't---mine is a bit wider but\nnot 200), but because it changes behaviour from the old code without any\ngood justification to do so.\n"},{"id":"185241","messageId":"7vipiy5e7y.fsf@alter.siamese.dyndns.org","threadId":"29675","inReplyTo":"1329775034-21551-1-git-send-email-zbyszek@in.waw.pl","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-23T05:08:17Z","receivedAt":"2012-02-23T05:08:17Z","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> this is v6, with a new approach.\n\nWhen you reroll, please make sure you do not run format-patch with\nnonstandard settings, e.g. \n\n\tdiff --git t/t4052-stat-output.sh t/t4052-stat-output.sh\n"},{"id":"185242","messageId":"buor4xmj9d2.fsf@dhlpc061.dev.necel.com","threadId":"29675","inReplyTo":"4F43C23C.8070304@in.waw.pl","subject":"Re: [PATCH 0/8 v6] diff --stat: use the full terminal width","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2012-02-23T07:29:29Z","receivedAt":"2012-02-23T07:29:29Z","isPatch":true,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Zbigniew Jędrzejewski-Szmek  <zbyszek@in.waw.pl> writes:\n> I use (or would like to be able to use) the --stat output to select with\n> the mouse and paste into something like\n>   emacsclient -n <pathname>\n> This would be harder with the grouping, because I'd have to select two\n> parts and paste two times and type a slash. So for me this would be a\n> minus.\n\nOf course, git's diffstats often already violate that property (e.g.,\nabbreviations and the renaming syntax)...  In cases where such a\ngrouping syntax avoids information-losing abbreviations, it might even\nbe an improvement over the current situation (even if the info was\nsplit up, at least it would be there).\n\nIf the heuristics were tuned so that the syntax only kicked in for\ncases where deep nesting or long names would otherwise make\nabbreviations likely, maybe it would be a general improvement.\n\nHowever, it does seem like the additional inconsistency of\npresentation might make diffstats harder to read or more ugly in some\ncases...\n\n-miles\n\n-- \nDawn, n. When men of reason go to bed.\n"},{"id":"185358","messageId":"4F47F394.5070007@in.waw.pl","threadId":"29675","inReplyTo":"7vr4xmac6f.fsf@alter.siamese.dyndns.org","subject":"[PATCH v7 0/11] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:31:16Z","receivedAt":"2012-02-24T20:31:16Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Hi,\n\nI accept your reasoning that a graph narrower than 80 columns would not \nlook good.\n\nOn 02/22/2012 08:41 PM, Junio C Hamano wrote:\n> It might be just the matter of raising the artificial cap to much higher\n> than 40-column (say, 80-column).  A possible alternative may be to declare\n> that the perceived ugliness is the user's problem of having overly wide\n> terminal in the first place and do without any such cap.\n>\n> Either is fine, but regressing output on 80-column terminal when showing a\n> patch with short filenames and large changes is unacceptable, not because\n> I personally use 80-col terminal myself (I don't---mine is a bit wider but\n> not 200), but because it changes behaviour from the old code without any\n> good justification to do so.\n\nI've taken both options :) The graph-width-limit is turned into an \noption (commandline --stat-graph-width and config diff.statGraphWidth), \noff by default. Now no tests need to be changed. But if somebody doesn't \nlike very wide graph output, they can set the config option to something \nlike 80 and forget about this.\n\nThis is on top of today's next. I'm sending 1/11 'make lineno_width() \nfrom blame reusable for others' again, because the version in next is \nthe previous version before s/int/uintmax_t/.\n\nChanges since v6:\n\n- 40 column limit for the graph part is changed in an optional, \nconfigurable limit, off by default\n- parts 7.1/8, 7.2/8, 7.3/8 get their own numbers, and 7.3 is split into \ntwo parts (9/10 is --stat-graph-width and 10/10 is diff.statGraphWidth).\n\nv6:\n[1/8]  make lineno_width() from blame reusable for others\n   This is very close to what was in pu, but I'm sending a new version:\n   - the function argument is changed from int to uintmax_t\n     (max_change is uintmax_t and 9/9 does decimal_width(max_change).)\n[2/8] diff --stat: tests for long filenames and big change counts\n   - Tests are run for format-patch, diff, log, show, and merge.\n   - Since tests are not only for format-patch, they are added in a new\n     file t/t4052-stat-output.sh.\n[3/8] diff --stat: use the full terminal width\n   Add logic to use term_columns() when diffopts.stat_width==-1 and\n   turn it on in git-diff --stat.\n   - show_stats() output is adapted to full terminal width only when\n     diffopts.stat_width==-1.\n[4/8] show --stat: use the full terminal width\n   Enable for git-show.\n[5/8] log --stat: use the full terminal width\n   Enable for log-show.\n[6/8] merge --stat: use the full terminal width\n   Enable for git-merge.\n[7/8] diff --stat: limit graph part to 40 columns\n   Change the logic to divide columns. This part is the unchanged from\n   v5, just separated from 3/9.\n[8/8] diff --stat: use less columns for change counts\n   This one is optional, to be applied or not, \"when the dust settles\".\n\nv5:\n- tests are moved to an earlier patch\n   - seq is replaced with a while loop for windows compatibility\n   - grep -m 1 is replaced with grep \" | \"\n   - redirects are made portable\n   - piped output is split into two commands to verify that the first \ncommand\n     sucessfully runs to completion\n- using decimal_width(change count) is moved to a later patch\n- \"histogram\" is really not used\n\n\nv4:\n- comments are updated and the word \"histogram\" is banished\n- \"mopping up\" is removed (but the minimum width are guaranteed)\n\nv3:\n- use decimal_width(max_change) to calculate number of columns\n   required for change counts\n- rework the logic to divide columns\n- document the logic in comments, update docs\n- add more tests\n\nv2:\n- style fixes\n- some tests for git-format-patch added\n- patches 3 and 4 squashed together, since they touch the same lines\n- graph width is limited to 40 columns, even if there's more space\n- patch descriptions extended and cleared up\n"},{"id":"185359","messageId":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"4F47F394.5070007@in.waw.pl","subject":"[PATCH v7 01/11] make lineno_width() from blame reusable for others","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:08Z","receivedAt":"2012-02-24T20:32:08Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"builtin/blame.c has a helper function to compute how many columns we\nneed to show a line-number, whose implementation is reusable as a more\ngeneric helper function to count the number of columns necessary to\nshow any cardinal number.\n\nRename it to decimal_width(), move it to pager.c and export it for use\nby future callers.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n builtin/blame.c | 18 +++---------------\n cache.h         |  1 +\n pager.c         | 13 +++++++++++++\n 3 files changed, 17 insertions(+), 15 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 01956c8..b35bd62 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -1829,18 +1829,6 @@ static int read_ancestry(const char *graft_file)\n }\n \n /*\n- * How many columns do we need to show line numbers in decimal?\n- */\n-static int lineno_width(int lines)\n-{\n-\tint i, width;\n-\n-\tfor (width = 1, i = 10; i <= lines; width++)\n-\t\ti *= 10;\n-\treturn width;\n-}\n-\n-/*\n  * How many columns do we need to show line numbers, authors,\n  * and filenames?\n  */\n@@ -1880,9 +1868,9 @@ static void find_alignment(struct scoreboard *sb, int *option)\n \t\tif (largest_score < ent_score(sb, e))\n \t\t\tlargest_score = ent_score(sb, e);\n \t}\n-\tmax_orig_digits = lineno_width(longest_src_lines);\n-\tmax_digits = lineno_width(longest_dst_lines);\n-\tmax_score_digits = lineno_width(largest_score);\n+\tmax_orig_digits = decimal_width(longest_src_lines);\n+\tmax_digits = decimal_width(longest_dst_lines);\n+\tmax_score_digits = decimal_width(largest_score);\n }\n \n /*\ndiff --git a/cache.h b/cache.h\nindex 881524f..d908184 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1187,6 +1187,7 @@ extern const char *pager_program;\n extern int pager_in_use(void);\n extern int pager_use_color;\n extern int term_columns(void);\n+extern int decimal_width(uintmax_t number);\n \n extern const char *editor_program;\n extern const char *askpass_program;\ndiff --git a/pager.c b/pager.c\nindex b790967..60be7bb 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -147,3 +147,16 @@ int term_columns(void)\n \n \treturn term_columns_at_startup;\n }\n+\n+/*\n+ * How many columns do we need to show this number in decimal?\n+ */\n+int decimal_width(uintmax_t number)\n+{\n+\tint width;\n+\tuintmax_t i;\n+\n+\tfor (width = 1, i = 10; i <= number; width++)\n+\t\ti *= 10;\n+\treturn width;\n+}\n-- \n1.7.9.2.332.g05f13\n"},{"id":"185360","messageId":"1330115538-1576-2-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 02/11] diff --stat: tests for long filenames and big change counts","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:09Z","receivedAt":"2012-02-24T20:32:09Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"In 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.  A couple of new tests marked with test_expect_failure\ndemonstrate this bug.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\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..031107b\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+cat >expect80 <<'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+EOF\n+\n+cat >expect40 <<-'EOF'\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+EOF\n+\n+while read cmd args\n+do\n+\ttest_expect_failure \"$cmd graph width defaults to 80 columns\" '\n+\t\tgit $cmd $args >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect80 actual\n+\t'\n+\n+\ttest_expect_failure \"$cmd --stat=width with long name\" '\n+\t\tgit $cmd $args --stat=40 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect40 actual\n+\t'\n+\n+\ttest_expect_failure \"$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 expect40 actual\n+\t'\n+\n+\ttest_expect_success \"$cmd --stat=...,name-width with long name\" '\n+\t\tgit $cmd $args --stat=60,29 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect40 actual\n+\t'\n+\n+\ttest_expect_success \"$cmd --stat-name-width with long name\" '\n+\t\tgit $cmd $args --stat-name-width=29 >output &&\n+\t\tgrep \" | \" output >actual &&\n+\t\ttest_cmp expect40 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+\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+\n+while read cmd args\n+do\n+\ttest_expect_success \"$cmd --stat=width with big change and long name\" '\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.332.g05f13\n"},{"id":"185361","messageId":"1330115538-1576-3-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 03/11] diff --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:10Z","receivedAt":"2012-02-24T20:32:10Z","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>\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 a1c06b5..1062f27 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1389,7 +1389,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 031107b..4bfd6a5 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -81,6 +81,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@@ -90,7 +94,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.332.g05f13\n"},{"id":"185362","messageId":"1330115538-1576-4-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 04/11] show --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:11Z","receivedAt":"2012-02-24T20:32:11Z","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>\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 4bfd6a5..91c4ba8 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -95,7 +95,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.332.g05f13\n"},{"id":"185363","messageId":"1330115538-1576-5-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 05/11] log --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:12Z","receivedAt":"2012-02-24T20:32:12Z","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>\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 91c4ba8..acc54cd 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -96,7 +96,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.332.g05f13\n"},{"id":"185364","messageId":"1330115538-1576-6-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 06/11] merge --stat: use the full terminal width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:13Z","receivedAt":"2012-02-24T20:32:13Z","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>\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 ed0f959..7b368e7 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 acc54cd..2b4510c 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.332.g05f13\n"},{"id":"185365","messageId":"1330115538-1576-7-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 07/11] diff --stat: use a maximum of 5/8 for the filename part","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:14Z","receivedAt":"2012-02-24T20:32:14Z","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 t4052 that fixes a\nfew tests marked with test_expect_failure.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n Documentation/diff-options.txt | 14 ++++---\n diff.c                         | 90 ++++++++++++++++++++++++++++--------------\n t/t4052-stat-output.sh         | 14 +++----\n 3 files changed, 75 insertions(+), 43 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 1062f27..318e070 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1375,7 +1375,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@@ -1389,28 +1389,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@@ -1431,19 +1418,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@@ -1499,18 +1529,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 2b4510c..c250744 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -28,19 +28,19 @@ EOF\n \n while read cmd args\n do\n-\ttest_expect_failure \"$cmd graph width defaults to 80 columns\" '\n+\ttest_expect_success \"$cmd graph width defaults to 80 columns\" '\n \t\tgit $cmd $args >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect80 actual\n \t'\n \n-\ttest_expect_failure \"$cmd --stat=width with long name\" '\n+\ttest_expect_success \"$cmd --stat=width with long name\" '\n \t\tgit $cmd $args --stat=40 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect40 actual\n \t'\n \n-\ttest_expect_failure \"$cmd --stat-width=width with long name\" '\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 expect40 actual\n@@ -87,7 +87,7 @@ EOF\n \n while read verb expect cmd args\n do\n-\ttest_expect_success \"$cmd $verb COLUMNS (big change)\" '\n+\ttest_expect_success \"$cmd $verb too many COLUMNS (big change)\" '\n \t\tCOLUMNS=200 git $cmd $args >output\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp \"$expect\" actual\n@@ -130,7 +130,7 @@ test_expect_success 'preparation for long filename tests' '\n '\n \n cat >expect <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++\n EOF\n \n while read cmd args\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.332.g05f13\n"},{"id":"185366","messageId":"1330115538-1576-8-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 08/11] diff --stat: add a test for output with COLUMNS=40","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:15Z","receivedAt":"2012-02-24T20:32:15Z","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>\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 c250744..84be8bd 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -99,6 +99,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.332.g05f13\n"},{"id":"185367","messageId":"1330115538-1576-9-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 09/11] diff --stat: enable limiting of the graph part","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:16Z","receivedAt":"2012-02-24T20:32:16Z","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>\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 318e070..9012c09 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1421,13 +1421,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@@ -1452,7 +1454,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@@ -1463,6 +1467,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@@ -3332,6 +3339,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@@ -3360,6 +3368,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@@ -3385,6 +3403,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 7af5f1e..e6a782c 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 84be8bd..e606202 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -135,6 +135,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.332.g05f13\n"},{"id":"185368","messageId":"1330115538-1576-10-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 10/11] diff --stat: add config option to limit graph width","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:17Z","receivedAt":"2012-02-24T20:32:17Z","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>\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 7b368e7..24843ec 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 554e30e..3be9077 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2091,6 +2091,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 9012c09..f47bffa 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@@ -1444,6 +1449,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 e606202..0bdeab7 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -110,6 +110,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.332.g05f13\n"},{"id":"185373","messageId":"1330115538-1576-11-git-send-email-zbyszek@in.waw.pl","threadId":"29675","inReplyTo":"1330115538-1576-1-git-send-email-zbyszek@in.waw.pl","subject":"[PATCH v7 11/11] diff --stat: use less columns for change counts","fromName":"Zbigniew Jędrzejewski-Szmek","fromEmail":"zbyszek@in.waw.pl","sentAt":"2012-02-24T20:32:18Z","receivedAt":"2012-02-24T20:32:18Z","isPatch":true,"sender":{"key":"zbyszek@in.waw.pl","avatar":"https://avatars.githubusercontent.com/u/349618?v=4"},"body":"Number of columns required for change counts is now computed based on\nthe maximum number of changed lines. This means that usually a few\nmore columns will be available for the filenames and the graph.\n\nThe graph width logic is also modified to include enough space for\n\"Bin XXX -> YYY bytes\".\n\nIf changes to binary files are mixed with changes to text files,\nchange counts are padded to take at least three columns. And the other\nway around, if change counts require more than three columns, then\n\"Bin\"s are padded to align with the change count. This way, the +-\npart starts in the same column as \"XXX -> YYY\" part for binary files.\nThis makes the graph easier to parse visually thanks to the empty\ncolumn. This mimics the layout of diff --stat before this change.\n\nTests and the tutorial are updated to reflect the new --stat output.\nThis means either the removal of extra padding and/or the addition of\nup to three extra characters to truncated filenames. One test is added\nto check the graph alignment when a binary file change and text file\nchange of more than 999 lines are committed together.\n\nSigned-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>\n---\n Documentation/gitcore-tutorial.txt                 |  4 +-\n diff.c                                             | 48 +++++++++++++++----\n t/t0023-crlf-am.sh                                 |  2 +-\n t/t1200-tutorial.sh                                |  4 +-\n t/t3404-rebase-interactive.sh                      |  2 +-\n t/t3903-stash.sh                                   |  4 +-\n t/t4012-diff-binary.sh                             | 19 ++++++++\n ...ff-tree_--cc_--patch-with-stat_--summary_master |  4 +-\n ...diff-tree_--cc_--patch-with-stat_--summary_side |  6 +--\n .../diff.diff-tree_--cc_--patch-with-stat_master   |  4 +-\n .../diff.diff-tree_--cc_--stat_--summary_master    |  4 +-\n t/t4013/diff.diff-tree_--cc_--stat_--summary_side  |  6 +--\n t/t4013/diff.diff-tree_--cc_--stat_master          |  4 +-\n ...pretty=oneline_--root_--patch-with-stat_initial |  6 +--\n .../diff.diff-tree_--pretty_--patch-with-stat_side |  6 +--\n ...-tree_--pretty_--root_--patch-with-stat_initial |  6 +--\n ...f-tree_--pretty_--root_--stat_--summary_initial |  6 +--\n .../diff.diff-tree_--pretty_--root_--stat_initial  |  6 +--\n ...diff.diff-tree_--root_--patch-with-stat_initial |  6 +--\n t/t4013/diff.diff-tree_-c_--stat_--summary_master  |  4 +-\n t/t4013/diff.diff-tree_-c_--stat_--summary_side    |  6 +--\n t/t4013/diff.diff-tree_-c_--stat_master            |  4 +-\n .../diff.diff_--patch-with-stat_-r_initial..side   |  6 +--\n t/t4013/diff.diff_--patch-with-stat_initial..side  |  6 +--\n t/t4013/diff.diff_--stat_initial..side             |  6 +--\n t/t4013/diff.diff_-r_--stat_initial..side          |  6 +--\n ..._--attach_--stdout_--suffix=.diff_initial..side |  6 +--\n ....format-patch_--attach_--stdout_initial..master | 16 +++----\n ...format-patch_--attach_--stdout_initial..master^ | 10 ++--\n ...ff.format-patch_--attach_--stdout_initial..side |  6 +--\n ...nline_--stdout_--numbered-files_initial..master | 16 +++----\n ...tdout_--subject-prefix=TESTCASE_initial..master | 16 +++----\n ....format-patch_--inline_--stdout_initial..master | 16 +++----\n ...format-patch_--inline_--stdout_initial..master^ | 10 ++--\n ...ormat-patch_--inline_--stdout_initial..master^^ |  6 +--\n ...ff.format-patch_--inline_--stdout_initial..side |  6 +--\n ...tch_--stdout_--cover-letter_-n_initial..master^ | 18 ++++----\n ...at-patch_--stdout_--no-numbered_initial..master | 16 +++----\n ...ormat-patch_--stdout_--numbered_initial..master | 16 +++----\n t/t4013/diff.format-patch_--stdout_initial..master | 16 +++----\n .../diff.format-patch_--stdout_initial..master^    | 10 ++--\n t/t4013/diff.format-patch_--stdout_initial..side   |  6 +--\n ....log_--patch-with-stat_--summary_master_--_dir_ |  6 +--\n t/t4013/diff.log_--patch-with-stat_master          | 16 +++----\n t/t4013/diff.log_--patch-with-stat_master_--_dir_  |  6 +--\n ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++------\n ...f.log_--root_--patch-with-stat_--summary_master | 22 ++++-----\n t/t4013/diff.log_--root_--patch-with-stat_master   | 22 ++++-----\n ...og_--root_-c_--patch-with-stat_--summary_master | 26 +++++------\n t/t4013/diff.show_--patch-with-stat_--summary_side |  6 +--\n t/t4013/diff.show_--patch-with-stat_side           |  6 +--\n t/t4013/diff.show_--stat_--summary_side            |  6 +--\n t/t4013/diff.show_--stat_side                      |  6 +--\n ...nged_--patch-with-stat_--summary_master_--_dir_ |  6 +--\n t/t4013/diff.whatchanged_--patch-with-stat_master  | 16 +++----\n ...ff.whatchanged_--patch-with-stat_master_--_dir_ |  6 +--\n ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++------\n ...anged_--root_--patch-with-stat_--summary_master | 22 ++++-----\n ...iff.whatchanged_--root_--patch-with-stat_master | 22 ++++-----\n ...ed_--root_-c_--patch-with-stat_--summary_master | 26 +++++------\n t/t4014-format-patch.sh                            |  2 +-\n t/t4016-diff-quote.sh                              | 14 +++---\n t/t4030-diff-textconv.sh                           |  2 +-\n t/t4043-diff-rename-binary.sh                      |  4 +-\n t/t4045-diff-relative.sh                           |  2 +-\n t/t4047-diff-dirstat.sh                            | 54 +++++++++++-----------\n t/t4049-diff-stat-count.sh                         |  4 +-\n t/t4052-stat-output.sh                             |  8 ++--\n t/t5100/patch0001                                  |  2 +-\n t/t5100/patch0002                                  |  2 +-\n t/t5100/patch0003                                  |  2 +-\n t/t5100/patch0005                                  |  4 +-\n t/t5100/patch0006                                  |  2 +-\n t/t5100/patch0010                                  |  2 +-\n t/t5100/patch0011                                  |  2 +-\n t/t5100/patch0014                                  |  2 +-\n t/t5100/patch0014--scissors                        |  2 +-\n t/t5100/sample.mbox                                | 18 ++++----\n t/t7602-merge-octopus-many.sh                      | 12 ++---\n 79 files changed, 417 insertions(+), 370 deletions(-)\n\ndiff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt\nindex fb0d569..5b5d5a4 100644\n--- a/Documentation/gitcore-tutorial.txt\n+++ b/Documentation/gitcore-tutorial.txt\n@@ -1002,8 +1002,8 @@ would be different)\n ----------------\n Updating from ae3a2da... to a80b4aa....\n Fast-forward (no commit created; -m option ignored)\n- example |    1 +\n- hello   |    1 +\n+ example | 1 +\n+ hello   | 1 +\n  2 files changed, 2 insertions(+)\n ----------------\n \ndiff --git a/diff.c b/diff.c\nindex f47bffa..15a69fb 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1379,8 +1379,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n {\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, graph_width, number_width = 4, count;\n+\tint total_files = data->nr, count;\n+\tint width, name_width, graph_width, number_width = 0, bin_width = 0;\n \tconst char *reset, *add_c, *del_c;\n \tconst char *line_prefix = \"\";\n \tint extra_shown = 0;\n@@ -1416,8 +1416,21 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\tif (max_len < len)\n \t\t\tmax_len = len;\n \n-\t\tif (file->is_binary || file->is_unmerged)\n+\t\tif (file->is_unmerged) {\n+\t\t\t/* \"Unmerged\" is 8 characters */\n+\t\t\tbin_width = bin_width < 8 ? 8 : bin_width;\n \t\t\tcontinue;\n+\t\t}\n+\t\tif (file->is_binary) {\n+\t\t\t/* \"Bin XXX -> YYY bytes\" */\n+\t\t\tint w = 14 + decimal_width(file->added)\n+\t\t\t\t+ decimal_width(file->deleted);\n+\t\t\tbin_width = bin_width < w ? w : bin_width;\n+\t\t\t/* Display change counts aligned with \"Bin\" */\n+\t\t\tnumber_width = 3;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tif (max_change < change)\n \t\t\tmax_change = change;\n \t}\n@@ -1442,12 +1455,22 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\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+\t * Binary files are displayed with \"Bin XXX -> YYY bytes\"\n+\t * instead of the change count and graph. This part is treated\n+\t * similarly to the graph part, except that it is not\n+\t * \"scaled\". If total width is too small to accomodate the\n+\t * guaranteed minimum width of the filename part and the\n+\t * separators and this message, this message will \"overflow\"\n+\t * making the line longer than the maximum width.\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+\tnumber_width = decimal_width(max_change) > number_width ?\n+\t\tdecimal_width(max_change) : number_width;\n \n \tif (options->stat_graph_width == -1)\n \t\toptions->stat_graph_width = diff_stat_graph_width;\n@@ -1461,10 +1484,14 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \n \t/*\n \t * First assign sizes that are wanted, ignoring available width.\n+\t * strlen(\"Bin XXX -> YYY bytes\") == bin_width, and the part\n+\t * starting from \"XXX\" should fit in graph_width.\n \t */\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+\tgraph_width = max_change + 4 > bin_width ? max_change : bin_width - 4;\n+\tif (options->stat_graph_width &&\n+\t    options->stat_graph_width < graph_width)\n+\t\tgraph_width = options->stat_graph_width;\n+\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@@ -1519,7 +1546,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\tif (data->files[i]->is_binary) {\n \t\t\tfprintf(options->file, \"%s\", line_prefix);\n \t\t\tshow_name(options->file, prefix, name, len);\n-\t\t\tfprintf(options->file, \"  Bin \");\n+\t\t\tfprintf(options->file, \" %*s \", number_width, \"Bin\");\n \t\t\tfprintf(options->file, \"%s%\"PRIuMAX\"%s\",\n \t\t\t\tdel_c, deleted, reset);\n \t\t\tfprintf(options->file, \" -> \");\n@@ -1532,7 +1559,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\telse if (data->files[i]->is_unmerged) {\n \t\t\tfprintf(options->file, \"%s\", line_prefix);\n \t\t\tshow_name(options->file, prefix, name, len);\n-\t\t\tfprintf(options->file, \"  Unmerged\\n\");\n+\t\t\tfprintf(options->file, \" Unmerged\\n\");\n \t\t\tcontinue;\n \t\t}\n \n@@ -1561,8 +1588,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)\n \t\t}\n \t\tfprintf(options->file, \"%s\", line_prefix);\n \t\tshow_name(options->file, prefix, name, len);\n-\t\tfprintf(options->file, \"%5\"PRIuMAX\"%s\", added + deleted,\n-\t\t\t\tadded + deleted ? \" \" : \"\");\n+\t\tfprintf(options->file, \" %*\"PRIuMAX\"%s\",\n+\t\t\tnumber_width, added + deleted,\n+\t\t\tadded + deleted ? \" \" : \"\");\n \t\tshow_graph(options->file, '+', add, add_c, reset);\n \t\tshow_graph(options->file, '-', del, del_c, reset);\n \t\tfprintf(options->file, \"\\n\");\ndiff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh\nindex aaed725..f9bbb91 100755\n--- a/t/t0023-crlf-am.sh\n+++ b/t/t0023-crlf-am.sh\n@@ -11,7 +11,7 @@ Date: Thu, 23 Aug 2007 13:00:00 +0200\n Subject: test1\n \n ---\n- foo |    1 +\n+ foo | 1 +\n  1 files changed, 1 insertions(+), 0 deletions(-)\n  create mode 100644 foo\n \ndiff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh\nindex 9356bea..397ccb6 100755\n--- a/t/t1200-tutorial.sh\n+++ b/t/t1200-tutorial.sh\n@@ -154,8 +154,8 @@ test_expect_success 'git show-branch' '\n cat > resolve.expect << EOF\n Updating VARIABLE..VARIABLE\n FASTFORWARD (no commit created; -m option ignored)\n- example |    1 +\n- hello   |    1 +\n+ example | 1 +\n+ hello   | 1 +\n  2 files changed, 2 insertions(+)\n EOF\n \ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex b981572..c8fe1a9 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -323,7 +323,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '\n \techo resolved > file1 &&\n \tgit add file1 &&\n \tgit rebase --continue > output &&\n-\tgrep \"^ file1 |    2 +-$\" output\n+\tgrep \"^ file1 | 2 +-$\" output\n '\n \n test_expect_success 'multi-squash only fires up editor once' '\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 663c60a..9b83c28 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -443,7 +443,7 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tcat >expected <<-EOF &&\n-\t file |    1 +\n+\t file | 1 +\n \t 1 file changed, 1 insertion(+)\n \tEOF\n \tgit stash show ${STASH_ID} >actual &&\n@@ -481,7 +481,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tcat >expected <<-EOF &&\n-\t file |    1 +\n+\t file | 1 +\n \t 1 file changed, 1 insertion(+)\n \tEOF\n \tgit stash show ${STASH_ID} >actual &&\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 2d9f9a0..971e66a 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -90,4 +90,23 @@ test_expect_success 'diff --no-index with binary creation' '\n \ttest_cmp expected actual\n '\n \n+cat >expect <<EOF\n+ binfile  |   Bin 0 -> 1026 bytes\n+ textfile | 10000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+EOF\n+\n+test_expect_success 'diff --stat with binary files and big change count' '\n+\techo X | dd of=binfile bs=1k seek=1 &&\n+\tgit add binfile &&\n+\ti=0 &&\n+\twhile test $i -lt 10000; do\n+\t\techo $i &&\n+\t\ti=$(($i + 1))\n+\tdone >textfile &&\n+\tgit add textfile &&\n+\tgit diff --cached --stat binfile textfile >output &&\n+\tgrep \" | \" output >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\ndiff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master\nindex 2f8560c..9951e36 100644\n--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master\n@@ -1,7 +1,7 @@\n $ git diff-tree --cc --patch-with-stat --summary master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\ndiff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side\nindex 72e03c1..cec33fa 100644\n--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side\n+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side\n@@ -1,8 +1,8 @@\n $ git diff-tree --cc --patch-with-stat --summary side\n c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master\nindex 8b357d9..db3c0a7 100644\n--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master\n+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master\n@@ -1,7 +1,7 @@\n $ git diff-tree --cc --patch-with-stat master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\ndiff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master\nindex e0568d6..d019867 100644\n--- a/t/t4013/diff.diff-tree_--cc_--stat_--summary_master\n+++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git diff-tree --cc --stat --summary master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side\nindex 5afc823..12b2eee 100644\n--- a/t/t4013/diff.diff-tree_--cc_--stat_--summary_side\n+++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side\n@@ -1,8 +1,8 @@\n $ git diff-tree --cc --stat --summary side\n c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n $\ndiff --git a/t/t4013/diff.diff-tree_--cc_--stat_master b/t/t4013/diff.diff-tree_--cc_--stat_master\nindex f48367a..40b9179 100644\n--- a/t/t4013/diff.diff-tree_--cc_--stat_master\n+++ b/t/t4013/diff.diff-tree_--cc_--stat_master\n@@ -1,6 +1,6 @@\n $ git diff-tree --cc --stat master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial\nindex 590864c..817ed06 100644\n--- a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial\n+++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial\n@@ -1,8 +1,8 @@\n $ git diff-tree --pretty=oneline --root --patch-with-stat initial\n 444ac553ac7612cc88969031b02b3767fb8a353a Initial\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side\nindex e05e778..fe3f6b7 100644\n--- a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side\n+++ b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial\nindex 0e2c956..06eb77e 100644\n--- a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial\n+++ b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial\nindex 384fa44..680eab5 100644\n--- a/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial\n+++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial\nindex 10384a8..9722d1b 100644\n--- a/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial\n+++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial\n@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n $\ndiff --git a/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial\nindex f57062e..ad69ffe 100644\n--- a/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial\n+++ b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial\n@@ -1,8 +1,8 @@\n $ git diff-tree --root --patch-with-stat initial\n 444ac553ac7612cc88969031b02b3767fb8a353a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_master b/t/t4013/diff.diff-tree_-c_--stat_--summary_master\nindex 7088683..81c3021 100644\n--- a/t/t4013/diff.diff-tree_-c_--stat_--summary_master\n+++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_master\n@@ -1,6 +1,6 @@\n $ git diff-tree -c --stat --summary master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_side b/t/t4013/diff.diff-tree_-c_--stat_--summary_side\nindex ef216ab..e8dc12b 100644\n--- a/t/t4013/diff.diff-tree_-c_--stat_--summary_side\n+++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_side\n@@ -1,8 +1,8 @@\n $ git diff-tree -c --stat --summary side\n c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n $\ndiff --git a/t/t4013/diff.diff-tree_-c_--stat_master b/t/t4013/diff.diff-tree_-c_--stat_master\nindex ad19f10..89d59b1 100644\n--- a/t/t4013/diff.diff-tree_-c_--stat_master\n+++ b/t/t4013/diff.diff-tree_-c_--stat_master\n@@ -1,6 +1,6 @@\n $ git diff-tree -c --stat master\n 59d314ad6f356dd08601a4cd5e530381da3e3c64\n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n $\ndiff --git a/t/t4013/diff.diff_--patch-with-stat_-r_initial..side b/t/t4013/diff.diff_--patch-with-stat_-r_initial..side\nindex ddad917..be8d1ea 100644\n--- a/t/t4013/diff.diff_--patch-with-stat_-r_initial..side\n+++ b/t/t4013/diff.diff_--patch-with-stat_-r_initial..side\n@@ -1,7 +1,7 @@\n $ git diff --patch-with-stat -r initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.diff_--patch-with-stat_initial..side b/t/t4013/diff.diff_--patch-with-stat_initial..side\nindex bdbd114..5424e6d 100644\n--- a/t/t4013/diff.diff_--patch-with-stat_initial..side\n+++ b/t/t4013/diff.diff_--patch-with-stat_initial..side\n@@ -1,7 +1,7 @@\n $ git diff --patch-with-stat initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.diff_--stat_initial..side b/t/t4013/diff.diff_--stat_initial..side\nindex 6d08f3d..b7741e2 100644\n--- a/t/t4013/diff.diff_--stat_initial..side\n+++ b/t/t4013/diff.diff_--stat_initial..side\n@@ -1,6 +1,6 @@\n $ git diff --stat initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n $\ndiff --git a/t/t4013/diff.diff_-r_--stat_initial..side b/t/t4013/diff.diff_-r_--stat_initial..side\nindex 2ddb254..5d514f5 100644\n--- a/t/t4013/diff.diff_-r_--stat_initial..side\n+++ b/t/t4013/diff.diff_-r_--stat_initial..side\n@@ -1,6 +1,6 @@\n $ git diff -r --stat initial..side\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n $\ndiff --git a/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side\nindex 3cab049..547ca06 100644\n--- a/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side\n+++ b/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side\n@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master b/t/t4013/diff.format-patch_--attach_--stdout_initial..master\nindex 564a4d3..52fedc1 100644\n--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master\n+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^\nindex 4f28460..1c3cde2 100644\n--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^\n+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_initial..side\nindex b10cc2e..4717bd8 100644\n--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..side\n+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..side\n@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master\nindex a976a8a..02c4db7 100644\n--- a/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master\n+++ b/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master\nindex b4fd664..c7677c5 100644\n--- a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master\n+++ b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_initial..master\nindex 0d31036..5b3e34e 100644\n--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master\n+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^\nindex 18d4714..d13f8a8 100644\n--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^\n+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\nindex 29e00ab..caec553 100644\n--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\n+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^\n@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \ndiff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..side b/t/t4013/diff.format-patch_--inline_--stdout_initial..side\nindex 3572f20..d3a6762 100644\n--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..side\n+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..side\n@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed\n Content-Transfer-Encoding: 8bit\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\nindex 54cdcda..244d964 100644\n--- a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n+++ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^\n@@ -10,10 +10,10 @@ A U Thor (2):\n   Second\n   Third\n \n- dir/sub |    4 ++++\n- file0   |    3 +++\n- file1   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 4 ++++\n+ file0   | 3 +++\n+ file1   | 3 +++\n+ file2   | 3 ---\n  4 files changed, 10 insertions(+), 3 deletions(-)\n  create mode 100644 file1\n  delete mode 100644 file2\n@@ -28,9 +28,9 @@ Subject: [DIFFERENT_PREFIX 1/2] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -73,8 +73,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [DIFFERENT_PREFIX 2/2] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git a/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master b/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master\nindex 23194eb..bfc287a 100644\n--- a/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master\n+++ b/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master\n@@ -6,9 +6,9 @@ Subject: [PATCH] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--stdout_--numbered_initial..master b/t/t4013/diff.format-patch_--stdout_--numbered_initial..master\nindex 78f1a80..568f6f5 100644\n--- a/t/t4013/diff.format-patch_--stdout_--numbered_initial..master\n+++ b/t/t4013/diff.format-patch_--stdout_--numbered_initial..master\n@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH 2/3] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH 3/3] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--stdout_initial..master b/t/t4013/diff.format-patch_--stdout_initial..master\nindex a3dab7f..5f0352f 100644\n--- a/t/t4013/diff.format-patch_--stdout_initial..master\n+++ b/t/t4013/diff.format-patch_--stdout_initial..master\n@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH 2/3] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH 3/3] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.format-patch_--stdout_initial..master^ b/t/t4013/diff.format-patch_--stdout_initial..master^\nindex 39f4a3f..2ae454d 100644\n--- a/t/t4013/diff.format-patch_--stdout_initial..master^\n+++ b/t/t4013/diff.format-patch_--stdout_initial..master^\n@@ -6,9 +6,9 @@ Subject: [PATCH 1/2] Second\n \n This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000\n Subject: [PATCH 2/2] Third\n \n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \ndiff --git a/t/t4013/diff.format-patch_--stdout_initial..side b/t/t4013/diff.format-patch_--stdout_initial..side\nindex 8810920..a7d52fb 100644\n--- a/t/t4013/diff.format-patch_--stdout_initial..side\n+++ b/t/t4013/diff.format-patch_--stdout_initial..side\n@@ -5,9 +5,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000\n Subject: [PATCH] Side\n \n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\nindex 4085bbd..a18f147 100644\n--- a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\n+++ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_\n@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.log_--patch-with-stat_master b/t/t4013/diff.log_--patch-with-stat_master\nindex 4586279..ae425c4 100644\n--- a/t/t4013/diff.log_--patch-with-stat_master\n+++ b/t/t4013/diff.log_--patch-with-stat_master\n@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.log_--patch-with-stat_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_\nindex 6e172cf..d5207ca 100644\n--- a/t/t4013/diff.log_--patch-with-stat_master_--_dir_\n+++ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_\n@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\nindex 48b0d4b..0fc1e8c 100644\n--- a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master\nindex f9dc512..dffc09d 100644\n--- a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master\n@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -55,8 +55,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -88,9 +88,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -130,9 +130,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git a/t/t4013/diff.log_--root_--patch-with-stat_master b/t/t4013/diff.log_--root_--patch-with-stat_master\nindex 0807ece..55aa980 100644\n--- a/t/t4013/diff.log_--root_--patch-with-stat_master\n+++ b/t/t4013/diff.log_--root_--patch-with-stat_master\n@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\n@@ -127,9 +127,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\nindex 84f5ef6..019d85f 100644\n--- a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --combined dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git a/t/t4013/diff.show_--patch-with-stat_--summary_side b/t/t4013/diff.show_--patch-with-stat_--summary_side\nindex e60384d..95a474e 100644\n--- a/t/t4013/diff.show_--patch-with-stat_--summary_side\n+++ b/t/t4013/diff.show_--patch-with-stat_--summary_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \ndiff --git a/t/t4013/diff.show_--patch-with-stat_side b/t/t4013/diff.show_--patch-with-stat_side\nindex a3a3255..974e99b 100644\n--- a/t/t4013/diff.show_--patch-with-stat_side\n+++ b/t/t4013/diff.show_--patch-with-stat_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.show_--stat_--summary_side b/t/t4013/diff.show_--stat_--summary_side\nindex d16f464..a71492f 100644\n--- a/t/t4013/diff.show_--stat_--summary_side\n+++ b/t/t4013/diff.show_--stat_--summary_side\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n $\ndiff --git a/t/t4013/diff.show_--stat_side b/t/t4013/diff.show_--stat_side\nindex 6300c05..9be7124 100644\n--- a/t/t4013/diff.show_--stat_side\n+++ b/t/t4013/diff.show_--stat_side\n@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n $\ndiff --git a/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_\nindex 16ae543..c8b6af2 100644\n--- a/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_\n+++ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_\n@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master b/t/t4013/diff.whatchanged_--patch-with-stat_master\nindex f3e45ec..1ac431b 100644\n--- a/t/t4013/diff.whatchanged_--patch-with-stat_master\n+++ b/t/t4013/diff.whatchanged_--patch-with-stat_master\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_\nindex c77f0bc..b30c285 100644\n--- a/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_\n+++ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_\n@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n+ dir/sub | 2 ++\n  1 file changed, 2 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\nindex 8d03efe..30aae78 100644\n--- a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --cc dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master\nindex 1874d06..db90e51 100644\n--- a/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -48,8 +48,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -81,9 +81,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -123,9 +123,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master\nindex 5211ff2..9a6cc92 100644\n--- a/t/t4013/diff.whatchanged_--root_--patch-with-stat_master\n+++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master\n@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\n@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n \n diff --git a/dir/sub b/dir/sub\n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n \n diff --git a/dir/sub b/dir/sub\ndiff --git a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\nindex ad30245..d1d32bd 100644\n--- a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\n+++ b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master\n@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000\n \n     Merge branch 'side'\n \n- dir/sub |    2 ++\n- file0   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n  2 files changed, 5 insertions(+)\n \n diff --combined dir/sub\n@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000\n \n     Side\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file3   |    4 ++++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file3   | 4 ++++\n  3 files changed, 9 insertions(+)\n  create mode 100644 file3\n \n@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000\n \n     Third\n ---\n- dir/sub |    2 ++\n- file1   |    3 +++\n+ dir/sub | 2 ++\n+ file1   | 3 +++\n  2 files changed, 5 insertions(+)\n  create mode 100644 file1\n \n@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000\n     \n     This is the second commit.\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 ---\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 ---\n  3 files changed, 5 insertions(+), 3 deletions(-)\n  delete mode 100644 file2\n \n@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000\n \n     Initial\n ---\n- dir/sub |    2 ++\n- file0   |    3 +++\n- file2   |    3 +++\n+ dir/sub | 2 ++\n+ file0   | 3 +++\n+ file2   | 3 +++\n  3 files changed, 8 insertions(+)\n  create mode 100644 dir/sub\n  create mode 100644 file0\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 7dfe716..3cfa960 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -519,7 +519,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '\n \n cat > expect << EOF\n ---\n- file |   16 ++++++++++++++++\n+ file | 16 ++++++++++++++++\n  1 file changed, 16 insertions(+)\n \n diff --git a/file b/file\ndiff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh\nindex ab0c2f0..e451f2a 100755\n--- a/t/t4016-diff-quote.sh\n+++ b/t/t4016-diff-quote.sh\n@@ -59,13 +59,13 @@ test_expect_success TABS_IN_FILENAMES 'git diff --summary -M HEAD' '\n \n test_expect_success TABS_IN_FILENAMES 'setup expected files' '\n cat >expect <<\\EOF\n- pathname.1 => \"Rpathname\\twith HT.0\"            |    0\n- pathname.3 => \"Rpathname\\nwith LF.0\"            |    0\n- \"pathname\\twith HT.3\" => \"Rpathname\\nwith LF.1\" |    0\n- pathname.2 => Rpathname with SP.0               |    0\n- \"pathname\\twith HT.2\" => Rpathname with SP.1    |    0\n- pathname.0 => Rpathname.0                       |    0\n- \"pathname\\twith HT.0\" => Rpathname.1            |    0\n+ pathname.1 => \"Rpathname\\twith HT.0\"            | 0\n+ pathname.3 => \"Rpathname\\nwith LF.0\"            | 0\n+ \"pathname\\twith HT.3\" => \"Rpathname\\nwith LF.1\" | 0\n+ pathname.2 => Rpathname with SP.0               | 0\n+ \"pathname\\twith HT.2\" => Rpathname with SP.1    | 0\n+ pathname.0 => Rpathname.0                       | 0\n+ \"pathname\\twith HT.0\" => Rpathname.1            | 0\n  7 files changed, 0 insertions(+), 0 deletions(-)\n EOF\n '\ndiff --git a/t/t4030-diff-textconv.sh b/t/t4030-diff-textconv.sh\nindex 4ac162c..bd95f93 100755\n--- a/t/t4030-diff-textconv.sh\n+++ b/t/t4030-diff-textconv.sh\n@@ -85,7 +85,7 @@ test_expect_success 'status -v produces text' '\n '\n \n cat >expect.stat <<'EOF'\n- file |  Bin 2 -> 4 bytes\n+ file | Bin 2 -> 4 bytes\n  1 file changed, 0 insertions(+), 0 deletions(-)\n EOF\n test_expect_success 'diffstat does not run textconv' '\ndiff --git a/t/t4043-diff-rename-binary.sh b/t/t4043-diff-rename-binary.sh\nindex 0601281..ad0b2da 100755\n--- a/t/t4043-diff-rename-binary.sh\n+++ b/t/t4043-diff-rename-binary.sh\n@@ -23,8 +23,8 @@ test_expect_success 'move the files into a \"sub\" directory' '\n '\n \n cat > expected <<\\EOF\n- bar => sub/bar |  Bin 5 -> 5 bytes\n- foo => sub/foo |    0\n+ bar => sub/bar | Bin 5 -> 5 bytes\n+ foo => sub/foo |   0\n  2 files changed, 0 insertions(+), 0 deletions(-)\n \n diff --git a/bar b/sub/bar\ndiff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh\nindex bd119be..ba33578 100755\n--- a/t/t4045-diff-relative.sh\n+++ b/t/t4045-diff-relative.sh\n@@ -32,7 +32,7 @@ test_expect_success \"-p $*\" \"\n check_stat() {\n expect=$1; shift\n cat >expected <<EOF\n- $expect |    1 +\n+ $expect | 1 +\n  1 file changed, 1 insertion(+)\n EOF\n test_expect_success \"--stat $*\" \"\ndiff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh\nindex 29e80a5..75eaf16 100755\n--- a/t/t4047-diff-dirstat.sh\n+++ b/t/t4047-diff-dirstat.sh\n@@ -252,41 +252,41 @@ EOF\n '\n \n cat <<EOF >expect_diff_stat\n- changed/text             |    2 +-\n- dst/copy/changed/text    |   10 ++++++++++\n- dst/copy/rearranged/text |   10 ++++++++++\n- dst/copy/unchanged/text  |   10 ++++++++++\n- dst/move/changed/text    |   10 ++++++++++\n- dst/move/rearranged/text |   10 ++++++++++\n- dst/move/unchanged/text  |   10 ++++++++++\n- rearranged/text          |    2 +-\n- src/move/changed/text    |   10 ----------\n- src/move/rearranged/text |   10 ----------\n- src/move/unchanged/text  |   10 ----------\n+ changed/text             |  2 +-\n+ dst/copy/changed/text    | 10 ++++++++++\n+ dst/copy/rearranged/text | 10 ++++++++++\n+ dst/copy/unchanged/text  | 10 ++++++++++\n+ dst/move/changed/text    | 10 ++++++++++\n+ dst/move/rearranged/text | 10 ++++++++++\n+ dst/move/unchanged/text  | 10 ++++++++++\n+ rearranged/text          |  2 +-\n+ src/move/changed/text    | 10 ----------\n+ src/move/rearranged/text | 10 ----------\n+ src/move/unchanged/text  | 10 ----------\n  11 files changed, 62 insertions(+), 32 deletions(-)\n EOF\n \n cat <<EOF >expect_diff_stat_M\n- changed/text                      |    2 +-\n- dst/copy/changed/text             |   10 ++++++++++\n- dst/copy/rearranged/text          |   10 ++++++++++\n- dst/copy/unchanged/text           |   10 ++++++++++\n- {src => dst}/move/changed/text    |    2 +-\n- {src => dst}/move/rearranged/text |    2 +-\n- {src => dst}/move/unchanged/text  |    0\n- rearranged/text                   |    2 +-\n+ changed/text                      |  2 +-\n+ dst/copy/changed/text             | 10 ++++++++++\n+ dst/copy/rearranged/text          | 10 ++++++++++\n+ dst/copy/unchanged/text           | 10 ++++++++++\n+ {src => dst}/move/changed/text    |  2 +-\n+ {src => dst}/move/rearranged/text |  2 +-\n+ {src => dst}/move/unchanged/text  |  0\n+ rearranged/text                   |  2 +-\n  8 files changed, 34 insertions(+), 4 deletions(-)\n EOF\n \n cat <<EOF >expect_diff_stat_CC\n- changed/text                      |    2 +-\n- {src => dst}/copy/changed/text    |    2 +-\n- {src => dst}/copy/rearranged/text |    2 +-\n- {src => dst}/copy/unchanged/text  |    0\n- {src => dst}/move/changed/text    |    2 +-\n- {src => dst}/move/rearranged/text |    2 +-\n- {src => dst}/move/unchanged/text  |    0\n- rearranged/text                   |    2 +-\n+ changed/text                      | 2 +-\n+ {src => dst}/copy/changed/text    | 2 +-\n+ {src => dst}/copy/rearranged/text | 2 +-\n+ {src => dst}/copy/unchanged/text  | 0\n+ {src => dst}/move/changed/text    | 2 +-\n+ {src => dst}/move/rearranged/text | 2 +-\n+ {src => dst}/move/unchanged/text  | 0\n+ rearranged/text                   | 2 +-\n  8 files changed, 6 insertions(+), 6 deletions(-)\n EOF\n \ndiff --git a/t/t4049-diff-stat-count.sh b/t/t4049-diff-stat-count.sh\nindex a6d1887..d7231ee 100755\n--- a/t/t4049-diff-stat-count.sh\n+++ b/t/t4049-diff-stat-count.sh\n@@ -14,8 +14,8 @@ test_expect_success setup '\n \techo a >a &&\n \techo b >b &&\n \tcat >expect <<-\\EOF\n-\t a |    1 +\n-\t b |    1 +\n+\t a | 1 +\n+\t b | 1 +\n \t 2 files changed, 2 insertions(+)\n \tEOF\n \tgit diff --stat --stat-count=2 >actual &&\ndiff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh\nindex 0bdeab7..202e37e 100755\n--- a/t/t4052-stat-output.sh\n+++ b/t/t4052-stat-output.sh\n@@ -19,11 +19,11 @@ test_expect_success 'preparation' '\n \tgit commit -m message \"$name\"\n '\n cat >expect80 <<'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n EOF\n \n cat >expect40 <<-'EOF'\n- ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +\n+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +\n EOF\n \n while read cmd args\n@@ -47,13 +47,13 @@ do\n \t'\n \n \ttest_expect_success \"$cmd --stat=...,name-width with long name\" '\n-\t\tgit $cmd $args --stat=60,29 >output &&\n+\t\tgit $cmd $args --stat=60,32 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect40 actual\n \t'\n \n \ttest_expect_success \"$cmd --stat-name-width with long name\" '\n-\t\tgit $cmd $args --stat-name-width=29 >output &&\n+\t\tgit $cmd $args --stat-name-width=32 >output &&\n \t\tgrep \" | \" output >actual &&\n \t\ttest_cmp expect40 actual\n \t'\ndiff --git a/t/t5100/patch0001 b/t/t5100/patch0001\nindex 8ce1551..02c9774 100644\n--- a/t/t5100/patch0001\n+++ b/t/t5100/patch0001\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git a/t/t5100/patch0002 b/t/t5100/patch0002\nindex 8ce1551..02c9774 100644\n--- a/t/t5100/patch0002\n+++ b/t/t5100/patch0002\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git a/t/t5100/patch0003 b/t/t5100/patch0003\nindex 8ce1551..02c9774 100644\n--- a/t/t5100/patch0003\n+++ b/t/t5100/patch0003\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git a/t/t5100/patch0005 b/t/t5100/patch0005\nindex 7d24b24..ab7a383 100644\n--- a/t/t5100/patch0005\n+++ b/t/t5100/patch0005\n@@ -1,7 +1,7 @@\n ---\n \n- Documentation/git-cvsimport-script.txt |    9 ++++++++-\n- git-cvsimport-script                   |    4 ++--\n+ Documentation/git-cvsimport-script.txt | 9 ++++++++-\n+ git-cvsimport-script                   | 4 ++--\n  2 files changed, 10 insertions(+), 3 deletions(-)\n \n 50452f9c0c2df1f04d83a26266ba704b13861632\ndiff --git a/t/t5100/patch0006 b/t/t5100/patch0006\nindex 8ce1551..02c9774 100644\n--- a/t/t5100/patch0006\n+++ b/t/t5100/patch0006\n@@ -1,5 +1,5 @@\n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\ndiff --git a/t/t5100/patch0010 b/t/t5100/patch0010\nindex f055481..436821c 100644\n--- a/t/t5100/patch0010\n+++ b/t/t5100/patch0010\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c |    2 +-\n+ builtin-mailinfo.c | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git a/t/t5100/patch0011 b/t/t5100/patch0011\nindex 8841d3c..0988713 100644\n--- a/t/t5100/patch0011\n+++ b/t/t5100/patch0011\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c  |    4 ++--\n+ builtin-mailinfo.c  | 4 ++--\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n index 3e5fe51..aabfe5c 100644\ndiff --git a/t/t5100/patch0014 b/t/t5100/patch0014\nindex 124efd2..3f3825f 100644\n--- a/t/t5100/patch0014\n+++ b/t/t5100/patch0014\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-\n+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-\n  1 files changed, 36 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git a/t/t5100/patch0014--scissors b/t/t5100/patch0014--scissors\nindex 124efd2..3f3825f 100644\n--- a/t/t5100/patch0014--scissors\n+++ b/t/t5100/patch0014--scissors\n@@ -1,5 +1,5 @@\n ---\n- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-\n+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-\n  1 files changed, 36 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox\nindex de10312..34a09a0 100644\n--- a/t/t5100/sample.mbox\n+++ b/t/t5100/sample.mbox\n@@ -12,7 +12,7 @@ Subject: [PATCH] a commit.\n Here is a patch from A U Thor.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -52,7 +52,7 @@ two truly blank and another full of spaces in between.\n Hope this helps.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -83,7 +83,7 @@ Message-Id: <nitpicker.12121212@example.net>\n Hopefully this would fix the problem stated there.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -249,8 +249,8 @@ actual flags.\n Signed-off-by: David K=E5gedal <davidk@lysator.liu.se>\n ---\n \n- Documentation/git-cvsimport-script.txt |    9 ++++++++-\n- git-cvsimport-script                   |    4 ++--\n+ Documentation/git-cvsimport-script.txt | 9 ++++++++-\n+ git-cvsimport-script                   | 4 ++--\n  2 files changed, 10 insertions(+), 3 deletions(-)\n \n 50452f9c0c2df1f04d83a26266ba704b13861632\n@@ -379,7 +379,7 @@ Subject: [PATCH] a commit.\n Here is a patch from A U Thor.\n \n ---\n- foo |    2 +-\n+ foo | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/foo b/foo\n@@ -449,7 +449,7 @@ memcmp(\"Subject: \", header[i], 7) will never match.\n Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n Signed-off-by: Junio C Hamano <gitster@pobox.com>\n ---\n- builtin-mailinfo.c |    2 +-\n+ builtin-mailinfo.c | 2 +-\n  1 files changed, 1 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n@@ -482,7 +482,7 @@ Content-Transfer-Encoding: quoted-printable\n Here comes a commit log message, and\n its second line is here.\n ---\n- builtin-mailinfo.c  |    4 ++--\n+ builtin-mailinfo.c  | 4 ++--\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n index 3e5fe51..aabfe5c 100644\n@@ -587,7 +587,7 @@ everything before it in the message body.\n \n Signed-off-by: Junio C Hamano <gitster@pobox.com>\n ---\n- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-\n+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-\n  1 files changed, 36 insertions(+), 1 deletions(-)\n \n diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\ndiff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh\nindex 5783ebf..1479b8f 100755\n--- a/t/t7602-merge-octopus-many.sh\n+++ b/t/t7602-merge-octopus-many.sh\n@@ -54,9 +54,9 @@ Trying simple merge with c2\n Trying simple merge with c3\n Trying simple merge with c4\n Merge made by the 'octopus' strategy.\n- c2.c |    1 +\n- c3.c |    1 +\n- c4.c |    1 +\n+ c2.c | 1 +\n+ c3.c | 1 +\n+ c4.c | 1 +\n  3 files changed, 3 insertions(+)\n  create mode 100644 c2.c\n  create mode 100644 c3.c\n@@ -73,7 +73,7 @@ cat >expected <<\\EOF\n Already up-to-date with c4\n Trying simple merge with c5\n Merge made by the 'octopus' strategy.\n- c5.c |    1 +\n+ c5.c | 1 +\n  1 file changed, 1 insertion(+)\n  create mode 100644 c5.c\n EOF\n@@ -87,8 +87,8 @@ cat >expected <<\\EOF\n Fast-forwarding to: c1\n Trying simple merge with c2\n Merge made by the 'octopus' strategy.\n- c1.c |    1 +\n- c2.c |    1 +\n+ c1.c | 1 +\n+ c2.c | 1 +\n  2 files changed, 2 insertions(+)\n  create mode 100644 c1.c\n  create mode 100644 c2.c\n-- \n1.7.9.2.332.g05f13\n"}]}