{"thread":{"id":"13919","subject":"[PATCH] t/.gitattributes: only ignore whitespace errors in test files","startedAt":"2008-06-12T22:35:59Z","lastAt":"2008-06-14T07:30:12Z","messageCount":19,"participants":["Lea Wiemann","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"79648","messageId":"1213310159-28049-1-git-send-email-LeWiemann@gmail.com","threadId":"13919","inReplyTo":null,"subject":"[PATCH] t/.gitattributes: only ignore whitespace errors in test files","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-06-12T22:35:59Z","receivedAt":"2008-06-12T22:35:59Z","isPatch":true,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"Only ignore whitespace errors in t/tNNNN-*.sh and the t/tNNNN\nsubdirectories.  Other files (like test libraries) should still be\nchecked.\n\nAlso fix a whitespace error in t/test-lib.sh.\n\nSigned-off-by: Lea Wiemann <LeWiemann@gmail.com>\n---\n t/.gitattributes |    3 ++-\n t/test-lib.sh    |    2 +-\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/.gitattributes b/t/.gitattributes\nindex 562b12e..ab6edbf 100644\n--- a/t/.gitattributes\n+++ b/t/.gitattributes\n@@ -1 +1,2 @@\n-* -whitespace\n+t[0-9][0-9][0-9][0-9]-*.sh -whitespace\n+t[0-9][0-9][0-9][0-9]/* -whitespace\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 2a08cdc..73079d8 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -168,7 +168,7 @@ trap 'die' exit\n # environment variables to work around this.\n #\n # In particular, quoting isn't enough, as the path may contain the same quote\n-# that we're using. \n+# that we're using.\n test_set_editor () {\n \tFAKE_EDITOR=\"$1\"\n \texport FAKE_EDITOR\n-- \n1.5.6.rc2.23.gfef6b.dirty\n"},{"id":"79680","messageId":"20080613060629.GC26768@sigill.intra.peff.net","threadId":"13919","inReplyTo":"1213310159-28049-1-git-send-email-LeWiemann@gmail.com","subject":"Re: [PATCH] t/.gitattributes: only ignore whitespace errors in test files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-13T06:06:30Z","receivedAt":"2008-06-13T06:06:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 13, 2008 at 12:35:59AM +0200, Lea Wiemann wrote:\n\n> Only ignore whitespace errors in t/tNNNN-*.sh and the t/tNNNN\n> subdirectories.  Other files (like test libraries) should still be\n> checked.\n\nWhy?\n\nWhat is the difference between test-lib.sh and tNNNN-*.sh that makes one\nsubject to whitespace checking and the other not?\n\n(I suspect the answer is \"shoving all the code in tNNNN-*.sh into eval'd\nstrings screws up the whitespace checking\", but my point is that I\nshouldn't have to guess; the justification should go in the commit\nmessage).\n\n-Peff\n"},{"id":"79699","messageId":"1213343373-24104-1-git-send-email-LeWiemann@gmail.com","threadId":"13919","inReplyTo":"20080613060629.GC26768@sigill.intra.peff.net","subject":"[PATCH v2] t/.gitattributes: only ignore whitespace errors in test files","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-06-13T07:49:33Z","receivedAt":"2008-06-13T07:49:33Z","isPatch":true,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"Only ignore whitespace errors in t/tNNNN-*.sh and the t/tNNNN\nsubdirectories (since they can contain test-relevant trailing\nwhitespace).  Other files (like test libraries) should still be\nchecked.\n\nAlso fix a whitespace error in t/test-lib.sh.\n\nSigned-off-by: Lea Wiemann <LeWiemann@gmail.com>\n---\nJeff King wrote:\n> What is the difference between test-lib.sh and tNNNN-*.sh that makes one\n> subject to whitespace checking and the other not?\n\nI thought that was obvious since they had been not been checked before\neither (see the diff). :) Anyways, added explanation in parens in the\ncommit message; nothing else has changed since v1.\n\n t/.gitattributes |    3 ++-\n t/test-lib.sh    |    2 +-\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/.gitattributes b/t/.gitattributes\nindex 562b12e..ab6edbf 100644\n--- a/t/.gitattributes\n+++ b/t/.gitattributes\n@@ -1 +1,2 @@\n-* -whitespace\n+t[0-9][0-9][0-9][0-9]-*.sh -whitespace\n+t[0-9][0-9][0-9][0-9]/* -whitespace\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 7a8bd27..e9c9081 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -168,7 +168,7 @@ trap 'die' exit\n # environment variables to work around this.\n #\n # In particular, quoting isn't enough, as the path may contain the same quote\n-# that we're using. \n+# that we're using.\n test_set_editor () {\n \tFAKE_EDITOR=\"$1\"\n \texport FAKE_EDITOR\n-- \n1.5.6.rc2.33.g0b5e3.dirty\n"},{"id":"79700","messageId":"7vod65wt6k.fsf@gitster.siamese.dyndns.org","threadId":"13919","inReplyTo":"20080613060629.GC26768@sigill.intra.peff.net","subject":"Re: [PATCH] t/.gitattributes: only ignore whitespace errors in test files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-13T10:00:35Z","receivedAt":"2008-06-13T10:00:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Jun 13, 2008 at 12:35:59AM +0200, Lea Wiemann wrote:\n>\n>> Only ignore whitespace errors in t/tNNNN-*.sh and the t/tNNNN\n>> subdirectories.  Other files (like test libraries) should still be\n>> checked.\n>\n> Why?\n>\n> What is the difference between test-lib.sh and tNNNN-*.sh that makes one\n> subject to whitespace checking and the other not?\n\nEventually we would want to make all of the t/*.sh not exempt from the\nwhitespace rules.  Some currently do have trailing whitespaces as part of\ntheir embedded test vectors, but there are many that are more carefully\nwritten to avoid trailing whitespaces, by marking the EOL explicitly with\na non whitespace characters in the source, and running sed to produce the\nactual vector that is used in the test.  That style is vastly preferrable\nthan having actual lines that end with trailing whitespaces, because it\nmakes it much clearer what is being fed to the scripts and what are\nexpected output when reading the source.  You do not have to \"cat -e\" to\nsee what they exactly do.\n\nSo I think this is one step in the right direction.  I do not want to keep\ntNNNN-*.sh exemption forever.\n"},{"id":"79806","messageId":"20080614064857.GA8930@sigill.intra.peff.net","threadId":"13919","inReplyTo":"7vod65wt6k.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] t/.gitattributes: only ignore whitespace errors in test files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T06:48:57Z","receivedAt":"2008-06-14T06:48:57Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 13, 2008 at 03:00:35AM -0700, Junio C Hamano wrote:\n\n> Eventually we would want to make all of the t/*.sh not exempt from the\n> whitespace rules.  Some currently do have trailing whitespaces as part of\n\nThis turned out to be a fairly easy change, as most of the places had\nbeen caught already.\n\nFour part patch series follows. The only one potentially not\nmaint-worthy is 3/4, because it actually changes git's output slightly.\n\n  1/4: fix whitespace violations in test scripts\n  2/4: mask necessary whitespace policy violations in test scripts\n  3/4: avoid trailing whitespace in zero-change diffstat lines\n  4/4: enable whitespace checking of test scripts\n\n-Peff\n"},{"id":"79807","messageId":"20080614065119.GA9006@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614064857.GA8930@sigill.intra.peff.net","subject":"[PATCH 1/4] fix whitespace violations in test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T06:51:19Z","receivedAt":"2008-06-14T06:51:19Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"These violations are simply wrong, but were never caught\nbecause whitespace policy checking is turned off in the test\nscripts.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/t1502-rev-parse-parseopt.sh |    2 +-\n t/t3800-mktag.sh              |    2 +-\n t/t3903-stash.sh              |    2 +-\n t/t4014-format-patch.sh       |    6 +++---\n t/t4150-am.sh                 |    2 +-\n t/t5540-http-push.sh          |    2 +-\n 6 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh\nindex d24a47d..7cdd70a 100755\n--- a/t/t1502-rev-parse-parseopt.sh\n+++ b/t/t1502-rev-parse-parseopt.sh\n@@ -5,7 +5,7 @@ test_description='test git rev-parse --parseopt'\n \n cat > expect.err <<EOF\n usage: some-command [options] <args>...\n-    \n+\n     some-command does foo and bar!\n \n     -h, --help            show the help\ndiff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh\nindex df1fd6f..3907e67 100755\n--- a/t/t3800-mktag.sh\n+++ b/t/t3800-mktag.sh\n@@ -245,7 +245,7 @@ cat >tag.sig <<EOF\n object $head\n type commit\n tag mytag\n-tagger T A Gger <tagger@example.com>  \n+tagger T A Gger <tagger@example.com>\n \n EOF\n \ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 2d3ee3b..54d99ed 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -41,7 +41,7 @@ test_expect_success 'apply needs clean working directory' '\n \techo 4 > other-file &&\n \tgit add other-file &&\n \techo 5 > other-file &&\n- \ttest_must_fail git stash apply\n+\ttest_must_fail git stash apply\n '\n \n test_expect_success 'apply stashed changes' '\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 3583e68..7fe853c 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -98,7 +98,7 @@ test_expect_success 'extra headers' '\n \tsed -e \"/^$/q\" patch2 > hdrs2 &&\n \tgrep \"^To: R. E. Cipient <rcipient@example.com>$\" hdrs2 &&\n \tgrep \"^Cc: S. E. Cipient <scipient@example.com>$\" hdrs2\n-\t\n+\n '\n \n test_expect_success 'extra headers without newlines' '\n@@ -109,7 +109,7 @@ test_expect_success 'extra headers without newlines' '\n \tsed -e \"/^$/q\" patch3 > hdrs3 &&\n \tgrep \"^To: R. E. Cipient <rcipient@example.com>$\" hdrs3 &&\n \tgrep \"^Cc: S. E. Cipient <scipient@example.com>$\" hdrs3\n-\t\n+\n '\n \n test_expect_success 'extra headers with multiple To:s' '\n@@ -170,7 +170,7 @@ test_expect_success 'thread cover-letter' '\n \tgit checkout side &&\n \tgit format-patch --cover-letter --thread -o patches/ master &&\n \tFIRST_MID=$(grep \"Message-Id:\" patches/0000-* | sed \"s/^[^<]*\\(<[^>]*>\\).*$/\\1/\") &&\n-\tfor i in patches/0001-* patches/0002-* patches/0003-* \n+\tfor i in patches/0001-* patches/0002-* patches/0003-*\n \tdo\n \t  grep \"References: $FIRST_MID\" $i &&\n \t  grep \"In-Reply-To: $FIRST_MID\" $i || break\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 722ae96..bc98260 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -110,7 +110,7 @@ test_expect_success 'am applies patch correctly' '\n \n GIT_AUTHOR_NAME=\"Another Thor\"\n GIT_AUTHOR_EMAIL=\"a.thor@example.com\"\n-GIT_COMMITTER_NAME=\"Co M Miter\" \n+GIT_COMMITTER_NAME=\"Co M Miter\"\n GIT_COMMITTER_EMAIL=\"c.miter@example.com\"\n export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL\n \ndiff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh\nindex 7372439..f15dd03 100755\n--- a/t/t5540-http-push.sh\n+++ b/t/t5540-http-push.sh\n@@ -38,7 +38,7 @@ test_expect_success 'setup remote repository' '\n \tcd - &&\n \tmv test_repo.git $HTTPD_DOCUMENT_ROOT_PATH\n '\n-\t\n+\n test_expect_success 'clone remote repository' '\n \tcd \"$ROOT_PATH\" &&\n \tgit clone $HTTPD_URL/test_repo.git test_repo_clone\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79808","messageId":"20080614065428.GB9006@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614064857.GA8930@sigill.intra.peff.net","subject":"[PATCH 2/4] mask necessary whitespace policy violations in test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T06:54:28Z","receivedAt":"2008-06-14T06:54:28Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"All of these violations are necessary parts of the tests\n(which are generally checking the behavior of trailing\nwhitespace, or contain diff fragments with empty lines).\n\nOur solution is two-fold:\n\n  1. Process input with whitespace problems using tr. This\n     has the added bonus that it becomes very obvious where\n     the bogus whitespace is intended to go.\n\n  2. Move large diff fragments into their own supplemental\n     files. This gets rid of the whitespace problem, since\n     supplemental files are not checked, and it also makes\n     the test script a bit easier to read.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nActually, the diff fragments could simply use empty lines to indicate an\nempty context line, instead of a single space. This matches the GNU diff\nformat which Linus added support for a while back. However, I think\nthis change actually makes the test script more readable, and there is\nsomething wrong to me about taking advantage of a diff convention that\nwe complained so much about at the time. ;)\n\n t/t4015-diff-whitespace.sh |    8 +-\n t/t4109-apply-multifrag.sh |  132 +------------------------------------------\n t/t4109/patch1.patch       |   28 +++++++++\n t/t4109/patch2.patch       |   30 ++++++++++\n t/t4109/patch3.patch       |   31 ++++++++++\n t/t4109/patch4.patch       |   30 ++++++++++\n t/t4119-apply-config.sh    |    4 +-\n 7 files changed, 129 insertions(+), 134 deletions(-)\n create mode 100644 t/t4109/patch1.patch\n create mode 100644 t/t4109/patch2.patch\n create mode 100644 t/t4109/patch3.patch\n create mode 100644 t/t4109/patch4.patch\n\ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex ca0302f..b7cc6b2 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -62,16 +62,16 @@ EOF\n \n git update-index x\n \n-cat << EOF > x\n+tr '_' ' ' << EOF > x\n \twhitespace at beginning\n whitespace \t change\n white space in the middle\n-whitespace at end  \n+whitespace at end__\n unchanged line\n CR at end\n EOF\n \n-tr 'Q' '\\015' << EOF > expect\n+tr 'Q_' '\\015 ' << EOF > expect\n diff --git a/x b/x\n index d99af23..8b32fb5 100644\n --- a/x\n@@ -84,7 +84,7 @@ index d99af23..8b32fb5 100644\n +\twhitespace at beginning\n +whitespace \t change\n +white space in the middle\n-+whitespace at end  \n++whitespace at end__\n  unchanged line\n -CR at endQ\n +CR at end\ndiff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh\nindex bd40a21..ff5fdf3 100755\n--- a/t/t4109-apply-multifrag.sh\n+++ b/t/t4109-apply-multifrag.sh\n@@ -9,134 +9,10 @@ test_description='git apply test patches with multiple fragments.\n '\n . ./test-lib.sh\n \n-# setup\n-\n-cat > patch1.patch <<\\EOF\n-diff --git a/main.c b/main.c\n-new file mode 100644\n---- /dev/null\n-+++ b/main.c\n-@@ -0,0 +1,23 @@\n-+#include <stdio.h>\n-+\n-+int func(int num);\n-+void print_int(int num);\n-+\n-+int main() {\n-+\tint i;\n-+\n-+\tfor (i = 0; i < 10; i++) {\n-+\t\tprint_int(func(i));\n-+\t}\n-+\n-+\treturn 0;\n-+}\n-+\n-+int func(int num) {\n-+\treturn num * num;\n-+}\n-+\n-+void print_int(int num) {\n-+\tprintf(\"%d\", num);\n-+}\n-+\n-EOF\n-cat > patch2.patch <<\\EOF\n-diff --git a/main.c b/main.c\n---- a/main.c\n-+++ b/main.c\n-@@ -1,7 +1,9 @@\n-+#include <stdlib.h>\n- #include <stdio.h>\n- \n- int func(int num);\n- void print_int(int num);\n-+void print_ln();\n- \n- int main() {\n- \tint i;\n-@@ -10,6 +12,8 @@\n- \t\tprint_int(func(i));\n- \t}\n- \n-+\tprint_ln();\n-+\n- \treturn 0;\n- }\n- \n-@@ -21,3 +25,7 @@\n- \tprintf(\"%d\", num);\n- }\n- \n-+void print_ln() {\n-+\tprintf(\"\\n\");\n-+}\n-+\n-EOF\n-cat > patch3.patch <<\\EOF\n-diff --git a/main.c b/main.c\n---- a/main.c\n-+++ b/main.c\n-@@ -1,9 +1,7 @@\n--#include <stdlib.h>\n- #include <stdio.h>\n- \n- int func(int num);\n- void print_int(int num);\n--void print_ln();\n- \n- int main() {\n- \tint i;\n-@@ -12,8 +10,6 @@\n- \t\tprint_int(func(i));\n- \t}\n- \n--\tprint_ln();\n--\n- \treturn 0;\n- }\n- \n-@@ -25,7 +21,3 @@\n- \tprintf(\"%d\", num);\n- }\n- \n--void print_ln() {\n--\tprintf(\"\\n\");\n--}\n--\n-EOF\n-cat > patch4.patch <<\\EOF\n-diff --git a/main.c b/main.c\n---- a/main.c\n-+++ b/main.c\n-@@ -1,13 +1,14 @@\n- #include <stdio.h>\n- \n- int func(int num);\n--void print_int(int num);\n-+int func2(int num);\n- \n- int main() {\n- \tint i;\n- \n- \tfor (i = 0; i < 10; i++) {\n--\t\tprint_int(func(i));\n-+\t\tprintf(\"%d\", func(i));\n-+\t\tprintf(\"%d\", func3(i));\n- \t}\n- \n- \treturn 0;\n-@@ -17,7 +18,7 @@\n- \treturn num * num;\n- }\n- \n--void print_int(int num) {\n--\tprintf(\"%d\", num);\n-+int func2(int num) {\n-+\treturn num * num * num;\n- }\n- \n-EOF\n+cp ../t4109/patch1.patch .\n+cp ../t4109/patch2.patch .\n+cp ../t4109/patch3.patch .\n+cp ../t4109/patch4.patch .\n \n test_expect_success \"S = git apply (1)\" \\\n     'git apply patch1.patch patch2.patch'\ndiff --git a/t/t4109/patch1.patch b/t/t4109/patch1.patch\nnew file mode 100644\nindex 0000000..1d411fc\n--- /dev/null\n+++ b/t/t4109/patch1.patch\n@@ -0,0 +1,28 @@\n+diff --git a/main.c b/main.c\n+new file mode 100644\n+--- /dev/null\n++++ b/main.c\n+@@ -0,0 +1,23 @@\n++#include <stdio.h>\n++\n++int func(int num);\n++void print_int(int num);\n++\n++int main() {\n++\tint i;\n++\n++\tfor (i = 0; i < 10; i++) {\n++\t\tprint_int(func(i));\n++\t}\n++\n++\treturn 0;\n++}\n++\n++int func(int num) {\n++\treturn num * num;\n++}\n++\n++void print_int(int num) {\n++\tprintf(\"%d\", num);\n++}\n++\ndiff --git a/t/t4109/patch2.patch b/t/t4109/patch2.patch\nnew file mode 100644\nindex 0000000..8c6b06d\n--- /dev/null\n+++ b/t/t4109/patch2.patch\n@@ -0,0 +1,30 @@\n+diff --git a/main.c b/main.c\n+--- a/main.c\n++++ b/main.c\n+@@ -1,7 +1,9 @@\n++#include <stdlib.h>\n+ #include <stdio.h>\n+ \n+ int func(int num);\n+ void print_int(int num);\n++void print_ln();\n+ \n+ int main() {\n+ \tint i;\n+@@ -10,6 +12,8 @@\n+ \t\tprint_int(func(i));\n+ \t}\n+ \n++\tprint_ln();\n++\n+ \treturn 0;\n+ }\n+ \n+@@ -21,3 +25,7 @@\n+ \tprintf(\"%d\", num);\n+ }\n+ \n++void print_ln() {\n++\tprintf(\"\\n\");\n++}\n++\ndiff --git a/t/t4109/patch3.patch b/t/t4109/patch3.patch\nnew file mode 100644\nindex 0000000..d696c55\n--- /dev/null\n+++ b/t/t4109/patch3.patch\n@@ -0,0 +1,31 @@\n+cat > patch3.patch <<\\EOF\n+diff --git a/main.c b/main.c\n+--- a/main.c\n++++ b/main.c\n+@@ -1,9 +1,7 @@\n+-#include <stdlib.h>\n+ #include <stdio.h>\n+ \n+ int func(int num);\n+ void print_int(int num);\n+-void print_ln();\n+ \n+ int main() {\n+ \tint i;\n+@@ -12,8 +10,6 @@\n+ \t\tprint_int(func(i));\n+ \t}\n+ \n+-\tprint_ln();\n+-\n+ \treturn 0;\n+ }\n+ \n+@@ -25,7 +21,3 @@\n+ \tprintf(\"%d\", num);\n+ }\n+ \n+-void print_ln() {\n+-\tprintf(\"\\n\");\n+-}\n+-\ndiff --git a/t/t4109/patch4.patch b/t/t4109/patch4.patch\nnew file mode 100644\nindex 0000000..4b08590\n--- /dev/null\n+++ b/t/t4109/patch4.patch\n@@ -0,0 +1,30 @@\n+diff --git a/main.c b/main.c\n+--- a/main.c\n++++ b/main.c\n+@@ -1,13 +1,14 @@\n+ #include <stdio.h>\n+ \n+ int func(int num);\n+-void print_int(int num);\n++int func2(int num);\n+ \n+ int main() {\n+ \tint i;\n+ \n+ \tfor (i = 0; i < 10; i++) {\n+-\t\tprint_int(func(i));\n++\t\tprintf(\"%d\", func(i));\n++\t\tprintf(\"%d\", func3(i));\n+ \t}\n+ \n+ \treturn 0;\n+@@ -17,7 +18,7 @@\n+ \treturn num * num;\n+ }\n+ \n+-void print_int(int num) {\n+-\tprintf(\"%d\", num);\n++int func2(int num) {\n++\treturn num * num * num;\n+ }\n+ \ndiff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh\nindex b540f72..3c73a78 100755\n--- a/t/t4119-apply-config.sh\n+++ b/t/t4119-apply-config.sh\n@@ -19,12 +19,12 @@ test_expect_success setup '\n '\n \n # Also handcraft GNU diff output; note this has trailing whitespace.\n-cat >gpatch.file <<\\EOF &&\n+tr '_' ' ' >gpatch.file <<\\EOF &&\n --- file1\t2007-02-21 01:04:24.000000000 -0800\n +++ file1+\t2007-02-21 01:07:44.000000000 -0800\n @@ -1 +1 @@\n -A\n-+B \n++B_\n EOF\n \n sed -e 's|file1|sub/&|' gpatch.file >gpatch-sub.file &&\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79809","messageId":"20080614065614.GC9006@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614064857.GA8930@sigill.intra.peff.net","subject":"[PATCH 3/4] avoid trailing whitespace in zero-change diffstat lines","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T06:56:14Z","receivedAt":"2008-06-14T06:56:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"In some cases, we produce a diffstat line even though no\nlines have changed (e.g., because of an exact rename). In\nthis case, there is no +/- \"graph\" after the number of\nchanged lines. However, we output the space separator\nunconditionally, meaning that these lines contained a\ntrailing space character.\n\nThis isn't a huge problem, but in cleaning up the output we\nare able to eliminate some trailing whitespace from a test\nvector.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI can't imagine any programs actually depend on the trailing space, but\nthe output change does make this the only contentious patch.\n\n diff.c                |    3 ++-\n t/t4016-diff-quote.sh |   14 +++++++-------\n 2 files changed, 9 insertions(+), 8 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 62fdc54..f77f9e9 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -922,7 +922,8 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)\n \t\t\ttotal = add + del;\n \t\t}\n \t\tshow_name(options->file, prefix, name, len, reset, set);\n-\t\tfprintf(options->file, \"%5d \", added + deleted);\n+\t\tfprintf(options->file, \"%5d%s\", added + deleted,\n+\t\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/t4016-diff-quote.sh b/t/t4016-diff-quote.sh\nindex 0950250..f07035a 100755\n--- a/t/t4016-diff-quote.sh\n+++ b/t/t4016-diff-quote.sh\n@@ -53,13 +53,13 @@ test_expect_success 'git diff --summary -M HEAD' '\n '\n \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 test_expect_success 'git diff --stat -M HEAD' '\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79810","messageId":"20080614065636.GD9006@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614064857.GA8930@sigill.intra.peff.net","subject":"[PATCH 4/4] enable whitespace checking of test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T06:56:36Z","receivedAt":"2008-06-14T06:56:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Now that all of the policy violations have been cleaned up,\nwe can turn this on and start checking incoming patches.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nCheck and mate, whitespace.\n\n t/.gitattributes |    1 -\n 1 files changed, 0 insertions(+), 1 deletions(-)\n\ndiff --git a/t/.gitattributes b/t/.gitattributes\nindex ab6edbf..1b97c54 100644\n--- a/t/.gitattributes\n+++ b/t/.gitattributes\n@@ -1,2 +1 @@\n-t[0-9][0-9][0-9][0-9]-*.sh -whitespace\n t[0-9][0-9][0-9][0-9]/* -whitespace\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79811","messageId":"20080614070130.GA8968@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614065119.GA9006@sigill.intra.peff.net","subject":"Re: [PATCH 1/4] fix whitespace violations in test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:01:30Z","receivedAt":"2008-06-14T07:01:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jun 14, 2008 at 02:51:19AM -0400, Jeff King wrote:\n\n> --- a/t/t1502-rev-parse-parseopt.sh\n> +++ b/t/t1502-rev-parse-parseopt.sh\n> @@ -5,7 +5,7 @@ test_description='test git rev-parse --parseopt'\n>  \n>  cat > expect.err <<EOF\n>  usage: some-command [options] <args>...\n> -    \n> +\n>      some-command does foo and bar!\n>  \n>      -h, --help            show the help\n\n<sigh> I thought I had run all of the tests after this, but obviously I\nscrewed up. This is not a correct change.\n\nI will send out a respun patch in a second.\n\n-Peff\n"},{"id":"79816","messageId":"7v1w30iisy.fsf@gitster.siamese.dyndns.org","threadId":"13919","inReplyTo":"20080614065119.GA9006@sigill.intra.peff.net","subject":"Re: [PATCH 1/4] fix whitespace violations in test scripts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-14T07:20:45Z","receivedAt":"2008-06-14T07:20:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh\n> index d24a47d..7cdd70a 100755\n> --- a/t/t1502-rev-parse-parseopt.sh\n> +++ b/t/t1502-rev-parse-parseopt.sh\n> @@ -5,7 +5,7 @@ test_description='test git rev-parse --parseopt'\n>  \n>  cat > expect.err <<EOF\n>  usage: some-command [options] <args>...\n> -    \n> +\n>      some-command does foo and bar!\n>  \n>      -h, --help            show the help\n\nThis part unfortunately falls into the same category as your [3/4].\n\n---\n\n parse-options.c |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/parse-options.c b/parse-options.c\nindex acf3fe3..5e56bb5 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -312,8 +312,12 @@ void usage_with_options_internal(const char * const *usagestr,\n \tfprintf(stderr, \"usage: %s\\n\", *usagestr++);\n \twhile (*usagestr && **usagestr)\n \t\tfprintf(stderr, \"   or: %s\\n\", *usagestr++);\n-\twhile (*usagestr)\n-\t\tfprintf(stderr, \"    %s\\n\", *usagestr++);\n+\twhile (*usagestr) {\n+\t\tif (**usagestr)\n+\t\t\tfprintf(stderr, \"    %s\", *usagestr);\n+\t\tputc('\\n', stderr);\n+\t\tusagestr++;\n+\t}\n \n \tif (opts->type != OPTION_GROUP)\n \t\tfputc('\\n', stderr);\n"},{"id":"79817","messageId":"20080614072214.GA9975@sigill.intra.peff.net","threadId":"13919","inReplyTo":"7v1w30iisy.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/4] fix whitespace violations in test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:22:14Z","receivedAt":"2008-06-14T07:22:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jun 14, 2008 at 12:20:45AM -0700, Junio C Hamano wrote:\n\n> This part unfortunately falls into the same category as your [3/4].\n\nI was just about to send the same patch. Hold on, there is one other\nbug, and I am about to send the respun series.\n\n-Peff\n"},{"id":"79818","messageId":"7vtzfwh45d.fsf@gitster.siamese.dyndns.org","threadId":"13919","inReplyTo":"20080614065614.GC9006@sigill.intra.peff.net","subject":"Re: [PATCH 3/4] avoid trailing whitespace in zero-change diffstat lines","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-14T07:22:38Z","receivedAt":"2008-06-14T07:22:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> In some cases, we produce a diffstat line even though no lines have\n> changed (e.g., because of an exact rename). In this case, there is no\n> +/- \"graph\" after the number of changed lines. However, we output the\n> space separator unconditionally, meaning that these lines contained a\n> trailing space character.\n>\n> This isn't a huge problem, but in cleaning up the output we are able to\n> eliminate some trailing whitespace from a test vector.\n\nThis is why I love your patches.  Not merely fixing superficial issues but\ndoing so with _real thinking_ ;-)\n"},{"id":"79820","messageId":"20080614072556.GA17536@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614072214.GA9975@sigill.intra.peff.net","subject":"[PATCH v2 1/5] fix whitespace violations in test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:25:56Z","receivedAt":"2008-06-14T07:25:56Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"These violations are simply wrong, but were never caught\nbecause whitespace policy checking is turned off in the test\nscripts.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThe original was total crap. t1502 didn't pass (which is now fixed in\n3/4), and t3800 didn't pass (which is fixed correctly and lumped into\n2/4 now).\n\n t/t3903-stash.sh        |    2 +-\n t/t4014-format-patch.sh |    6 +++---\n t/t4150-am.sh           |    2 +-\n t/t5540-http-push.sh    |    2 +-\n 4 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 2d3ee3b..54d99ed 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -41,7 +41,7 @@ test_expect_success 'apply needs clean working directory' '\n \techo 4 > other-file &&\n \tgit add other-file &&\n \techo 5 > other-file &&\n- \ttest_must_fail git stash apply\n+\ttest_must_fail git stash apply\n '\n \n test_expect_success 'apply stashed changes' '\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 3583e68..7fe853c 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -98,7 +98,7 @@ test_expect_success 'extra headers' '\n \tsed -e \"/^$/q\" patch2 > hdrs2 &&\n \tgrep \"^To: R. E. Cipient <rcipient@example.com>$\" hdrs2 &&\n \tgrep \"^Cc: S. E. Cipient <scipient@example.com>$\" hdrs2\n-\t\n+\n '\n \n test_expect_success 'extra headers without newlines' '\n@@ -109,7 +109,7 @@ test_expect_success 'extra headers without newlines' '\n \tsed -e \"/^$/q\" patch3 > hdrs3 &&\n \tgrep \"^To: R. E. Cipient <rcipient@example.com>$\" hdrs3 &&\n \tgrep \"^Cc: S. E. Cipient <scipient@example.com>$\" hdrs3\n-\t\n+\n '\n \n test_expect_success 'extra headers with multiple To:s' '\n@@ -170,7 +170,7 @@ test_expect_success 'thread cover-letter' '\n \tgit checkout side &&\n \tgit format-patch --cover-letter --thread -o patches/ master &&\n \tFIRST_MID=$(grep \"Message-Id:\" patches/0000-* | sed \"s/^[^<]*\\(<[^>]*>\\).*$/\\1/\") &&\n-\tfor i in patches/0001-* patches/0002-* patches/0003-* \n+\tfor i in patches/0001-* patches/0002-* patches/0003-*\n \tdo\n \t  grep \"References: $FIRST_MID\" $i &&\n \t  grep \"In-Reply-To: $FIRST_MID\" $i || break\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 722ae96..bc98260 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -110,7 +110,7 @@ test_expect_success 'am applies patch correctly' '\n \n GIT_AUTHOR_NAME=\"Another Thor\"\n GIT_AUTHOR_EMAIL=\"a.thor@example.com\"\n-GIT_COMMITTER_NAME=\"Co M Miter\" \n+GIT_COMMITTER_NAME=\"Co M Miter\"\n GIT_COMMITTER_EMAIL=\"c.miter@example.com\"\n export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL\n \ndiff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh\nindex 7372439..f15dd03 100755\n--- a/t/t5540-http-push.sh\n+++ b/t/t5540-http-push.sh\n@@ -38,7 +38,7 @@ test_expect_success 'setup remote repository' '\n \tcd - &&\n \tmv test_repo.git $HTTPD_DOCUMENT_ROOT_PATH\n '\n-\t\n+\n test_expect_success 'clone remote repository' '\n \tcd \"$ROOT_PATH\" &&\n \tgit clone $HTTPD_URL/test_repo.git test_repo_clone\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79821","messageId":"20080614072637.GB17536@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614072214.GA9975@sigill.intra.peff.net","subject":"[PATCH v2 2/5] mask necessary whitespace policy violations in test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:26:37Z","receivedAt":"2008-06-14T07:26:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"All of these violations are necessary parts of the tests\n(which are generally checking the behavior of trailing\nwhitespace, or contain diff fragments with empty lines).\n\nOur solution is two-fold:\n\n  1. Process input with whitespace problems using tr. This\n     has the added bonus that it becomes very obvious where\n     the bogus whitespace is intended to go.\n\n  2. Move large diff fragments into their own supplemental\n     files. This gets rid of the whitespace problem, since\n     supplemental files are not checked, and it also makes\n     the test script a bit easier to read.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThis now has a fix for t3800 which was incorrectly fixed in the original\n1/4.\n\n t/t3800-mktag.sh           |    4 +-\n t/t4015-diff-whitespace.sh |    8 +-\n t/t4109-apply-multifrag.sh |  132 +------------------------------------------\n t/t4109/patch1.patch       |   28 +++++++++\n t/t4109/patch2.patch       |   30 ++++++++++\n t/t4109/patch3.patch       |   31 ++++++++++\n t/t4109/patch4.patch       |   30 ++++++++++\n t/t4119-apply-config.sh    |    4 +-\n 8 files changed, 131 insertions(+), 136 deletions(-)\n create mode 100644 t/t4109/patch1.patch\n create mode 100644 t/t4109/patch2.patch\n create mode 100644 t/t4109/patch3.patch\n create mode 100644 t/t4109/patch4.patch\n\ndiff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh\nindex df1fd6f..c851db8 100755\n--- a/t/t3800-mktag.sh\n+++ b/t/t3800-mktag.sh\n@@ -241,11 +241,11 @@ check_verify_failure 'disallow spaces in tag email' \\\n ############################################################\n # 17. disallow missing tag timestamp\n \n-cat >tag.sig <<EOF\n+tr '_' ' ' >tag.sig <<EOF\n object $head\n type commit\n tag mytag\n-tagger T A Gger <tagger@example.com>  \n+tagger T A Gger <tagger@example.com>__\n \n EOF\n \ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex ca0302f..b7cc6b2 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -62,16 +62,16 @@ EOF\n \n git update-index x\n \n-cat << EOF > x\n+tr '_' ' ' << EOF > x\n \twhitespace at beginning\n whitespace \t change\n white space in the middle\n-whitespace at end  \n+whitespace at end__\n unchanged line\n CR at end\n EOF\n \n-tr 'Q' '\\015' << EOF > expect\n+tr 'Q_' '\\015 ' << EOF > expect\n diff --git a/x b/x\n index d99af23..8b32fb5 100644\n --- a/x\n@@ -84,7 +84,7 @@ index d99af23..8b32fb5 100644\n +\twhitespace at beginning\n +whitespace \t change\n +white space in the middle\n-+whitespace at end  \n++whitespace at end__\n  unchanged line\n -CR at endQ\n +CR at end\ndiff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh\nindex bd40a21..ff5fdf3 100755\n--- a/t/t4109-apply-multifrag.sh\n+++ b/t/t4109-apply-multifrag.sh\n@@ -9,134 +9,10 @@ test_description='git apply test patches with multiple fragments.\n '\n . ./test-lib.sh\n \n-# setup\n-\n-cat > patch1.patch <<\\EOF\n-diff --git a/main.c b/main.c\n-new file mode 100644\n---- /dev/null\n-+++ b/main.c\n-@@ -0,0 +1,23 @@\n-+#include <stdio.h>\n-+\n-+int func(int num);\n-+void print_int(int num);\n-+\n-+int main() {\n-+\tint i;\n-+\n-+\tfor (i = 0; i < 10; i++) {\n-+\t\tprint_int(func(i));\n-+\t}\n-+\n-+\treturn 0;\n-+}\n-+\n-+int func(int num) {\n-+\treturn num * num;\n-+}\n-+\n-+void print_int(int num) {\n-+\tprintf(\"%d\", num);\n-+}\n-+\n-EOF\n-cat > patch2.patch <<\\EOF\n-diff --git a/main.c b/main.c\n---- a/main.c\n-+++ b/main.c\n-@@ -1,7 +1,9 @@\n-+#include <stdlib.h>\n- #include <stdio.h>\n- \n- int func(int num);\n- void print_int(int num);\n-+void print_ln();\n- \n- int main() {\n- \tint i;\n-@@ -10,6 +12,8 @@\n- \t\tprint_int(func(i));\n- \t}\n- \n-+\tprint_ln();\n-+\n- \treturn 0;\n- }\n- \n-@@ -21,3 +25,7 @@\n- \tprintf(\"%d\", num);\n- }\n- \n-+void print_ln() {\n-+\tprintf(\"\\n\");\n-+}\n-+\n-EOF\n-cat > patch3.patch <<\\EOF\n-diff --git a/main.c b/main.c\n---- a/main.c\n-+++ b/main.c\n-@@ -1,9 +1,7 @@\n--#include <stdlib.h>\n- #include <stdio.h>\n- \n- int func(int num);\n- void print_int(int num);\n--void print_ln();\n- \n- int main() {\n- \tint i;\n-@@ -12,8 +10,6 @@\n- \t\tprint_int(func(i));\n- \t}\n- \n--\tprint_ln();\n--\n- \treturn 0;\n- }\n- \n-@@ -25,7 +21,3 @@\n- \tprintf(\"%d\", num);\n- }\n- \n--void print_ln() {\n--\tprintf(\"\\n\");\n--}\n--\n-EOF\n-cat > patch4.patch <<\\EOF\n-diff --git a/main.c b/main.c\n---- a/main.c\n-+++ b/main.c\n-@@ -1,13 +1,14 @@\n- #include <stdio.h>\n- \n- int func(int num);\n--void print_int(int num);\n-+int func2(int num);\n- \n- int main() {\n- \tint i;\n- \n- \tfor (i = 0; i < 10; i++) {\n--\t\tprint_int(func(i));\n-+\t\tprintf(\"%d\", func(i));\n-+\t\tprintf(\"%d\", func3(i));\n- \t}\n- \n- \treturn 0;\n-@@ -17,7 +18,7 @@\n- \treturn num * num;\n- }\n- \n--void print_int(int num) {\n--\tprintf(\"%d\", num);\n-+int func2(int num) {\n-+\treturn num * num * num;\n- }\n- \n-EOF\n+cp ../t4109/patch1.patch .\n+cp ../t4109/patch2.patch .\n+cp ../t4109/patch3.patch .\n+cp ../t4109/patch4.patch .\n \n test_expect_success \"S = git apply (1)\" \\\n     'git apply patch1.patch patch2.patch'\ndiff --git a/t/t4109/patch1.patch b/t/t4109/patch1.patch\nnew file mode 100644\nindex 0000000..1d411fc\n--- /dev/null\n+++ b/t/t4109/patch1.patch\n@@ -0,0 +1,28 @@\n+diff --git a/main.c b/main.c\n+new file mode 100644\n+--- /dev/null\n++++ b/main.c\n+@@ -0,0 +1,23 @@\n++#include <stdio.h>\n++\n++int func(int num);\n++void print_int(int num);\n++\n++int main() {\n++\tint i;\n++\n++\tfor (i = 0; i < 10; i++) {\n++\t\tprint_int(func(i));\n++\t}\n++\n++\treturn 0;\n++}\n++\n++int func(int num) {\n++\treturn num * num;\n++}\n++\n++void print_int(int num) {\n++\tprintf(\"%d\", num);\n++}\n++\ndiff --git a/t/t4109/patch2.patch b/t/t4109/patch2.patch\nnew file mode 100644\nindex 0000000..8c6b06d\n--- /dev/null\n+++ b/t/t4109/patch2.patch\n@@ -0,0 +1,30 @@\n+diff --git a/main.c b/main.c\n+--- a/main.c\n++++ b/main.c\n+@@ -1,7 +1,9 @@\n++#include <stdlib.h>\n+ #include <stdio.h>\n+ \n+ int func(int num);\n+ void print_int(int num);\n++void print_ln();\n+ \n+ int main() {\n+ \tint i;\n+@@ -10,6 +12,8 @@\n+ \t\tprint_int(func(i));\n+ \t}\n+ \n++\tprint_ln();\n++\n+ \treturn 0;\n+ }\n+ \n+@@ -21,3 +25,7 @@\n+ \tprintf(\"%d\", num);\n+ }\n+ \n++void print_ln() {\n++\tprintf(\"\\n\");\n++}\n++\ndiff --git a/t/t4109/patch3.patch b/t/t4109/patch3.patch\nnew file mode 100644\nindex 0000000..d696c55\n--- /dev/null\n+++ b/t/t4109/patch3.patch\n@@ -0,0 +1,31 @@\n+cat > patch3.patch <<\\EOF\n+diff --git a/main.c b/main.c\n+--- a/main.c\n++++ b/main.c\n+@@ -1,9 +1,7 @@\n+-#include <stdlib.h>\n+ #include <stdio.h>\n+ \n+ int func(int num);\n+ void print_int(int num);\n+-void print_ln();\n+ \n+ int main() {\n+ \tint i;\n+@@ -12,8 +10,6 @@\n+ \t\tprint_int(func(i));\n+ \t}\n+ \n+-\tprint_ln();\n+-\n+ \treturn 0;\n+ }\n+ \n+@@ -25,7 +21,3 @@\n+ \tprintf(\"%d\", num);\n+ }\n+ \n+-void print_ln() {\n+-\tprintf(\"\\n\");\n+-}\n+-\ndiff --git a/t/t4109/patch4.patch b/t/t4109/patch4.patch\nnew file mode 100644\nindex 0000000..4b08590\n--- /dev/null\n+++ b/t/t4109/patch4.patch\n@@ -0,0 +1,30 @@\n+diff --git a/main.c b/main.c\n+--- a/main.c\n++++ b/main.c\n+@@ -1,13 +1,14 @@\n+ #include <stdio.h>\n+ \n+ int func(int num);\n+-void print_int(int num);\n++int func2(int num);\n+ \n+ int main() {\n+ \tint i;\n+ \n+ \tfor (i = 0; i < 10; i++) {\n+-\t\tprint_int(func(i));\n++\t\tprintf(\"%d\", func(i));\n++\t\tprintf(\"%d\", func3(i));\n+ \t}\n+ \n+ \treturn 0;\n+@@ -17,7 +18,7 @@\n+ \treturn num * num;\n+ }\n+ \n+-void print_int(int num) {\n+-\tprintf(\"%d\", num);\n++int func2(int num) {\n++\treturn num * num * num;\n+ }\n+ \ndiff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh\nindex b540f72..3c73a78 100755\n--- a/t/t4119-apply-config.sh\n+++ b/t/t4119-apply-config.sh\n@@ -19,12 +19,12 @@ test_expect_success setup '\n '\n \n # Also handcraft GNU diff output; note this has trailing whitespace.\n-cat >gpatch.file <<\\EOF &&\n+tr '_' ' ' >gpatch.file <<\\EOF &&\n --- file1\t2007-02-21 01:04:24.000000000 -0800\n +++ file1+\t2007-02-21 01:07:44.000000000 -0800\n @@ -1 +1 @@\n -A\n-+B \n++B_\n EOF\n \n sed -e 's|file1|sub/&|' gpatch.file >gpatch-sub.file &&\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79822","messageId":"20080614072721.GC17536@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614072214.GA9975@sigill.intra.peff.net","subject":"[PATCH v2 3/5] avoid whitespace on empty line in automatic usage message","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:27:21Z","receivedAt":"2008-06-14T07:27:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When outputting a usage message with a blank line in the\nheader, we would output a line with four spaces. Make this\ntruly a blank line.\n\nThis helps us remove trailing whitespace from a test vector.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThis is equivalent to the fix you just posted.\n\n parse-options.c               |    8 ++++++--\n t/t1502-rev-parse-parseopt.sh |    2 +-\n 2 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/parse-options.c b/parse-options.c\nindex acf3fe3..8071711 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -312,8 +312,12 @@ void usage_with_options_internal(const char * const *usagestr,\n \tfprintf(stderr, \"usage: %s\\n\", *usagestr++);\n \twhile (*usagestr && **usagestr)\n \t\tfprintf(stderr, \"   or: %s\\n\", *usagestr++);\n-\twhile (*usagestr)\n-\t\tfprintf(stderr, \"    %s\\n\", *usagestr++);\n+\twhile (*usagestr) {\n+\t\tfprintf(stderr, \"%s%s\\n\",\n+\t\t\t\t**usagestr ? \"    \" : \"\",\n+\t\t\t\t*usagestr);\n+\t\tusagestr++;\n+\t}\n \n \tif (opts->type != OPTION_GROUP)\n \t\tfputc('\\n', stderr);\ndiff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh\nindex d24a47d..7cdd70a 100755\n--- a/t/t1502-rev-parse-parseopt.sh\n+++ b/t/t1502-rev-parse-parseopt.sh\n@@ -5,7 +5,7 @@ test_description='test git rev-parse --parseopt'\n \n cat > expect.err <<EOF\n usage: some-command [options] <args>...\n-    \n+\n     some-command does foo and bar!\n \n     -h, --help            show the help\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79823","messageId":"20080614072745.GD17536@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614072214.GA9975@sigill.intra.peff.net","subject":"[PATCH v2 4/5] avoid trailing whitespace in zero-change diffstat lines","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:27:45Z","receivedAt":"2008-06-14T07:27:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"In some cases, we produce a diffstat line even though no\nlines have changed (e.g., because of an exact rename). In\nthis case, there is no +/- \"graph\" after the number of\nchanged lines. However, we output the space separator\nunconditionally, meaning that these lines contained a\ntrailing space character.\n\nThis isn't a huge problem, but in cleaning up the output we\nare able to eliminate some trailing whitespace from a test\nvector.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThis is identical to the original 3/4.\n\n diff.c                |    3 ++-\n t/t4016-diff-quote.sh |   14 +++++++-------\n 2 files changed, 9 insertions(+), 8 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 62fdc54..f77f9e9 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -922,7 +922,8 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)\n \t\t\ttotal = add + del;\n \t\t}\n \t\tshow_name(options->file, prefix, name, len, reset, set);\n-\t\tfprintf(options->file, \"%5d \", added + deleted);\n+\t\tfprintf(options->file, \"%5d%s\", added + deleted,\n+\t\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/t4016-diff-quote.sh b/t/t4016-diff-quote.sh\nindex 0950250..f07035a 100755\n--- a/t/t4016-diff-quote.sh\n+++ b/t/t4016-diff-quote.sh\n@@ -53,13 +53,13 @@ test_expect_success 'git diff --summary -M HEAD' '\n '\n \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 test_expect_success 'git diff --stat -M HEAD' '\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79824","messageId":"20080614072806.GE17536@sigill.intra.peff.net","threadId":"13919","inReplyTo":"20080614072214.GA9975@sigill.intra.peff.net","subject":"[PATCH v2 5/5] enable whitespace checking of test scripts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:28:07Z","receivedAt":"2008-06-14T07:28:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Now that all of the policy violations have been cleaned up,\nwe can turn this on and start checking incoming patches.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThis is identical to the original 4/4.\n\n t/.gitattributes |    1 -\n 1 files changed, 0 insertions(+), 1 deletions(-)\n\ndiff --git a/t/.gitattributes b/t/.gitattributes\nindex ab6edbf..1b97c54 100644\n--- a/t/.gitattributes\n+++ b/t/.gitattributes\n@@ -1,2 +1 @@\n-t[0-9][0-9][0-9][0-9]-*.sh -whitespace\n t[0-9][0-9][0-9][0-9]/* -whitespace\n-- \n1.5.6.rc2.183.g04614\n"},{"id":"79827","messageId":"20080614073012.GA17568@sigill.intra.peff.net","threadId":"13919","inReplyTo":"7vtzfwh45d.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 3/4] avoid trailing whitespace in zero-change diffstat lines","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-14T07:30:12Z","receivedAt":"2008-06-14T07:30:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jun 14, 2008 at 12:22:38AM -0700, Junio C Hamano wrote:\n\n> > This isn't a huge problem, but in cleaning up the output we are able to\n> > eliminate some trailing whitespace from a test vector.\n> \n> This is why I love your patches.  Not merely fixing superficial issues but\n> doing so with _real thinking_ ;-)\n\nHeh. I am still trying to remove the brown paper bag from sending\npatches to the test scripts that don't even pass!\n\n-Peff\n"}]}