{"thread":{"id":"32932","subject":"[PATCH 1/4] t/t7502: compare entire commit message with what was expected","startedAt":"2013-02-19T04:17:04Z","lastAt":"2013-02-19T20:35:40Z","messageCount":19,"participants":["Brandon Casey","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"209760","messageId":"1361247427-438-1-git-send-email-drafnel@gmail.com","threadId":"32932","inReplyTo":null,"subject":"[PATCH 1/4] t/t7502: compare entire commit message with what was expected","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2013-02-19T04:17:04Z","receivedAt":"2013-02-19T04:17:04Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"This test attempts to verify that a commit in \"verbatim\" mode, when\nsupplied a commit template, produces a commit in which the commit\nmessage matches exactly the template that was supplied.  But, since the\ncommit operation appends additional instructions for the user as\ncomments in the commit buffer, which would cause the comparison to fail,\nthis test decided to compare only the first three lines (the length of\nthe template) of the resulting commit message to the original template\nfile.\n\nThis has two problems.\n\n  1. It does not allow the template to be lengthened or shortened\n     without also modifying the number of lines that are considered\n     significant (i.e. the argument to 'head -n').\n  2. It will not catch a bug in git that causes git to append additional\n     lines to the commit message.\n\nSo, let's use the --no-status option to 'git commit' which will cause\ngit to refrain from appending the lines of instructional text to the\ncommit message.  This will allow the entire resulting commit message to\nbe compared against the expected value.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n t/t7502-commit.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\nindex cbd7a45..9040f8a 100755\n--- a/t/t7502-commit.sh\n+++ b/t/t7502-commit.sh\n@@ -181,8 +181,8 @@ test_expect_success 'cleanup commit messages (verbatim option,-t)' '\n \n \techo >>negative &&\n \t{ echo;echo \"# text\";echo; } >expect &&\n-\tgit commit --cleanup=verbatim -t expect -a &&\n-\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" |head -n 3 >actual &&\n+\tgit commit --cleanup=verbatim --no-status -t expect -a &&\n+\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" >actual &&\n \ttest_cmp expect actual\n \n '\n-- \n1.8.1.3.638.g372f416.dirty\n"},{"id":"209761","messageId":"1361247427-438-2-git-send-email-drafnel@gmail.com","threadId":"32932","inReplyTo":"1361247427-438-1-git-send-email-drafnel@gmail.com","subject":"[PATCH 2/4] t7502: demonstrate breakage with a commit message with trailing newlines","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2013-02-19T04:17:05Z","receivedAt":"2013-02-19T04:17:05Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"This test attempts to verify that a commit message supplied to 'git\ncommit' via the -m switch was used in full as the commit message for a\ncommit when --cleanup=verbatim was used.\n\nBut, this test has been broken since it was introduced.  Since the\ncommit message containing trailing newlines was supplied to 'git commit'\nusing a command substitution, the trailing newlines were removed by the\nshell.  This means that a string without any trailing newlines was\nactually supplied to 'git commit'.\n\nThe test was able to complete successfully since internally, git appends\ntwo newlines to each string supplied via the -m switch.  So, the two\nnewlines removed by the shell were then re-added by git, and the\nresulting commit matched what was expected.\n\nSo, let's move the initial creation of the commit message string out\nfrom within a previous test so that it stands alone.  Assign the desired\ncommit message to a variable using literal newlines.  Then populate the\nexpect file from the contents of the commit message variable.  This way\nthe shell variable becomes the authoritative source of the commit\nmessage and can be supplied via the -m switch with the trailing newlines\nintact.\n\nMark this test as failing, since it is not handled correctly by git.\nAs described above, git appends two extra newlines to every string\nsupplied via -m.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n t/t7502-commit.sh | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\nindex 9040f8a..39e55f8 100755\n--- a/t/t7502-commit.sh\n+++ b/t/t7502-commit.sh\n@@ -177,10 +177,18 @@ test_expect_success 'verbose respects diff config' '\n \tgit config --unset color.diff\n '\n \n+mesg_with_comment_and_newlines='\n+# text\n+\n+'\n+\n+test_expect_success 'prepare file with comment line and trailing newlines'  '\n+\tprintf \"%s\" \"$mesg_with_comment_and_newlines\" >expect\n+'\n+\n test_expect_success 'cleanup commit messages (verbatim option,-t)' '\n \n \techo >>negative &&\n-\t{ echo;echo \"# text\";echo; } >expect &&\n \tgit commit --cleanup=verbatim --no-status -t expect -a &&\n \tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" >actual &&\n \ttest_cmp expect actual\n@@ -196,10 +204,10 @@ test_expect_success 'cleanup commit messages (verbatim option,-F)' '\n \n '\n \n-test_expect_success 'cleanup commit messages (verbatim option,-m)' '\n+test_expect_failure 'cleanup commit messages (verbatim option,-m)' '\n \n \techo >>negative &&\n-\tgit commit --cleanup=verbatim -m \"$(cat expect)\" -a &&\n+\tgit commit --cleanup=verbatim -m \"$mesg_with_comment_and_newlines\" -a &&\n \tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n \ttest_cmp expect actual\n \n-- \n1.8.1.3.638.g372f416.dirty\n"},{"id":"209763","messageId":"1361247427-438-3-git-send-email-drafnel@gmail.com","threadId":"32932","inReplyTo":"1361247427-438-1-git-send-email-drafnel@gmail.com","subject":"[PATCH 3/4] git-commit: only append a newline to -m mesg if necessary","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2013-02-19T04:17:06Z","receivedAt":"2013-02-19T04:17:06Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Currently, git will append two newlines to every message supplied via\nthe -m switch.  The purpose of this is to allow -m to be supplied\nmultiple times and have each supplied string become a paragraph in the\nresulting commit message.\n\nNormally, this does not cause a problem since any trailing newlines will\nbe removed by the cleanup operation.  If cleanup=verbatim for example,\nthen the trailing newlines will not be removed and will survive into the\nresulting commit message.\n\nInstead, let's ensure that the string supplied to -m is newline terminated,\nbut only append a second newline when appending additional messages.\n\nFixes the test in t7502.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n builtin/commit.c  | 4 +++-\n t/t7502-commit.sh | 2 +-\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 3348aa1..d21d07a 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -124,8 +124,10 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)\n \tif (unset)\n \t\tstrbuf_setlen(buf, 0);\n \telse {\n+\t\tif (buf->len)\n+\t\t\tstrbuf_addch(buf, '\\n');\n \t\tstrbuf_addstr(buf, arg);\n-\t\tstrbuf_addstr(buf, \"\\n\\n\");\n+\t\tstrbuf_complete_line(buf);\n \t}\n \treturn 0;\n }\ndiff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\nindex 39e55f8..292bc08 100755\n--- a/t/t7502-commit.sh\n+++ b/t/t7502-commit.sh\n@@ -204,7 +204,7 @@ test_expect_success 'cleanup commit messages (verbatim option,-F)' '\n \n '\n \n-test_expect_failure 'cleanup commit messages (verbatim option,-m)' '\n+test_expect_success 'cleanup commit messages (verbatim option,-m)' '\n \n \techo >>negative &&\n \tgit commit --cleanup=verbatim -m \"$mesg_with_comment_and_newlines\" -a &&\n-- \n1.8.1.3.638.g372f416.dirty\n"},{"id":"209762","messageId":"1361247427-438-4-git-send-email-drafnel@gmail.com","threadId":"32932","inReplyTo":"1361247427-438-1-git-send-email-drafnel@gmail.com","subject":"[PATCH 4/4] Documentation/git-commit.txt: correct a few minor grammatical mistakes","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2013-02-19T04:17:07Z","receivedAt":"2013-02-19T04:17:07Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Signed-off-by: Brandon Casey <drafnel@gmail.com>\n---\n Documentation/git-commit.txt | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 0eb79cc..8ae7619 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -174,10 +174,10 @@ OPTIONS\n --cleanup=<mode>::\n \tThis option sets how the commit message is cleaned up.\n \tThe  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n-\tand 'default'. The 'default' mode will strip leading and\n+\tor 'default'. The 'default' mode will strip leading and\n \ttrailing empty lines and #commentary from the commit message\n-\tonly if the message is to be edited. Otherwise only whitespace\n-\tremoved. The 'verbatim' mode does not change message at all,\n+\tonly if the message is to be edited. Otherwise only whitespace is\n+\tremoved. The 'verbatim' mode does not change the message at all,\n \t'whitespace' removes just leading/trailing whitespace lines\n \tand 'strip' removes both whitespace and commentary. The default\n \tcan be changed by the 'commit.cleanup' configuration variable\n-- \n1.8.1.3.638.g372f416.dirty\n"},{"id":"209764","messageId":"20130219050813.GC19757@elie.Belkin","threadId":"32932","inReplyTo":"1361247427-438-1-git-send-email-drafnel@gmail.com","subject":"Re: [PATCH 1/4] t/t7502: compare entire commit message with what was expected","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-19T05:08:13Z","receivedAt":"2013-02-19T05:08:13Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Casey wrote:\n\n> So, let's use the --no-status option to 'git commit' which will cause\n> git to refrain from appending the lines of instructional text to the\n> commit message.  This will allow the entire resulting commit message to\n> be compared against the expected value.\n\nThe downside (not a new problem, but a downside nonetheless) is that\nit means the test doesn't demonstrate what --cleanup=verbatim --status\nwill do.\n\nHow about something like this?\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n\ndiff --git i/t/t7502-commit.sh w/t/t7502-commit.sh\nindex cbd7a459..64162fce 100755\n--- i/t/t7502-commit.sh\n+++ w/t/t7502-commit.sh\n@@ -180,15 +180,37 @@ test_expect_success 'verbose respects diff config' '\n test_expect_success 'cleanup commit messages (verbatim option,-t)' '\n \n \techo >>negative &&\n-\t{ echo;echo \"# text\";echo; } >expect &&\n-\tgit commit --cleanup=verbatim -t expect -a &&\n-\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" |head -n 3 >actual &&\n+\t{\n+\t\techo &&\n+\t\techo \"# text\" &&\n+\t\techo\n+\t} >template &&\n+\t{\n+\t\tcat template &&\n+\t\tcat <<-\\EOF &&\n+\n+\t\t# Please enter the commit message for your changes. Lines starting\n+\t\t# with '\\''#'\\'' will be kept; you may remove them yourself if you want to.\n+\t\t# An empty message aborts the commit.\n+\t\t#\n+\t\t# Author:    A U Thor <author@example.com>\n+\t\t#\n+\t\tEOF\n+\t\tgit commit -a --dry-run\n+\t} >expect &&\n+\tgit commit --cleanup=verbatim -t template -a &&\n+\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" >actual &&\n \ttest_cmp expect actual\n \n '\n \n test_expect_success 'cleanup commit messages (verbatim option,-F)' '\n \n+\t{\n+\t\techo &&\n+\t\techo \"# text\" &&\n+\t\techo\n+\t} >expect &&\n \techo >>negative &&\n \tgit commit --cleanup=verbatim -F expect -a &&\n \tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"},{"id":"209765","messageId":"20130219051059.GD19757@elie.Belkin","threadId":"32932","inReplyTo":"20130219050813.GC19757@elie.Belkin","subject":"Re: [PATCH 1/4] t/t7502: compare entire commit message with what was expected","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-19T05:10:59Z","receivedAt":"2013-02-19T05:10:59Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> +++ w/t/t7502-commit.sh\n[...]\n> +\t\t# Please enter the commit message for your changes. Lines starting\n> +\t\t# with '\\''#'\\'' will be kept; you may remove them yourself if you want to.\n> +\t\t# An empty message aborts the commit.\n> +\t\t#\n> +\t\t# Author:    A U Thor <author@example.com>\n> +\t\t#\n> +\t\tEOF\n> +\t\tgit commit -a --dry-run\n> +\t} >expect &&\n> +\tgit commit --cleanup=verbatim -t template -a &&\n> -\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" |head -n 3 >actual &&\n> +\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" >actual &&\n>  \ttest_cmp expect actual\n\nQuick correction: this would use test_i18ncmp instead of test_cmp if\nit ends up being a good idea.\n"},{"id":"209767","messageId":"20130219053919.GE19757@elie.Belkin","threadId":"32932","inReplyTo":"1361247427-438-2-git-send-email-drafnel@gmail.com","subject":"Re: [PATCH 2/4] t7502: demonstrate breakage with a commit message with trailing newlines","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-19T05:39:20Z","receivedAt":"2013-02-19T05:39:20Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Casey wrote:\n\n> This test attempts to verify that a commit message supplied to 'git\n> commit' via the -m switch was used in full as the commit message for a\n> commit when --cleanup=verbatim was used.\n[...]\n> The test was able to complete successfully since internally, git appends\n> two newlines to each string supplied via the -m switch.\n[...]\n> Mark this test as failing, since it is not handled correctly by git.\n> As described above, git appends two extra newlines to every string\n> supplied via -m.\n\nGood catch.  This is an old one, triggered by a combination of\n\n v1.5.4-rc0~78^2~23 builtin-commit: resurrect behavior for multiple -m\n                    options, 2007-11-11\n\nand\n\n v1.5.4-rc2~3^2 Allow selection of different cleanup modes for commit\n                messages, 2007-12-22\n\nThe patch makes sense and makes the test easier to read, so\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\n(Patch left unsnipped for reference.)\n\n> Signed-off-by: Brandon Casey <drafnel@gmail.com>\n> ---\n>  t/t7502-commit.sh | 14 +++++++++++---\n>  1 file changed, 11 insertions(+), 3 deletions(-)\n> \n> diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\n> index 9040f8a..39e55f8 100755\n> --- a/t/t7502-commit.sh\n> +++ b/t/t7502-commit.sh\n> @@ -177,10 +177,18 @@ test_expect_success 'verbose respects diff config' '\n>  \tgit config --unset color.diff\n>  '\n>  \n> +mesg_with_comment_and_newlines='\n> +# text\n> +\n> +'\n> +\n> +test_expect_success 'prepare file with comment line and trailing newlines'  '\n> +\tprintf \"%s\" \"$mesg_with_comment_and_newlines\" >expect\n> +'\n> +\n>  test_expect_success 'cleanup commit messages (verbatim option,-t)' '\n>  \n>  \techo >>negative &&\n> -\t{ echo;echo \"# text\";echo; } >expect &&\n>  \tgit commit --cleanup=verbatim --no-status -t expect -a &&\n>  \tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" >actual &&\n>  \ttest_cmp expect actual\n> @@ -196,10 +204,10 @@ test_expect_success 'cleanup commit messages (verbatim option,-F)' '\n>  \n>  '\n>  \n> -test_expect_success 'cleanup commit messages (verbatim option,-m)' '\n> +test_expect_failure 'cleanup commit messages (verbatim option,-m)' '\n>  \n>  \techo >>negative &&\n> -\tgit commit --cleanup=verbatim -m \"$(cat expect)\" -a &&\n> +\tgit commit --cleanup=verbatim -m \"$mesg_with_comment_and_newlines\" -a &&\n>  \tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n>  \ttest_cmp expect actual\n>  \n> -- \n"},{"id":"209769","messageId":"20130219063121.GF19757@elie.Belkin","threadId":"32932","inReplyTo":"1361247427-438-3-git-send-email-drafnel@gmail.com","subject":"Re: [PATCH 3/4] git-commit: only append a newline to -m mesg if necessary","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-19T06:31:21Z","receivedAt":"2013-02-19T06:31:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Casey wrote:\n\n> Currently, git will append two newlines to every message supplied via\n> the -m switch.  The purpose of this is to allow -m to be supplied\n> multiple times and have each supplied string become a paragraph in the\n> resulting commit message.\n>\n> Normally, this does not cause a problem since any trailing newlines will\n> be removed by the cleanup operation.  If cleanup=verbatim for example,\n> then the trailing newlines will not be removed and will survive into the\n> resulting commit message.\n>\n> Instead, let's ensure that the string supplied to -m is newline terminated,\n> but only append a second newline when appending additional messages.\n[...]\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -124,8 +124,10 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)\n>  \tif (unset)\n>  \t\tstrbuf_setlen(buf, 0);\n>  \telse {\n> +\t\tif (buf->len)\n> +\t\t\tstrbuf_addch(buf, '\\n');\n>  \t\tstrbuf_addstr(buf, arg);\n> -\t\tstrbuf_addstr(buf, \"\\n\\n\");\n> +\t\tstrbuf_complete_line(buf);\n\nAs long as 'message' always consists of complete lines, this will\nappend 'arg' as a new paragraph, as desired.  And no other code path\ntouches 'message', so it always consists of complete lines.\n\nThanks for a clear patch and explanation.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\n(rest of patch kept unsnipped for reference)\n\n>  \t}\n>  \treturn 0;\n>  }\n> diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh\n> index 39e55f8..292bc08 100755\n> --- a/t/t7502-commit.sh\n> +++ b/t/t7502-commit.sh\n> @@ -204,7 +204,7 @@ test_expect_success 'cleanup commit messages (verbatim option,-F)' '\n>  \n>  '\n>  \n> -test_expect_failure 'cleanup commit messages (verbatim option,-m)' '\n> +test_expect_success 'cleanup commit messages (verbatim option,-m)' '\n>  \n>  \techo >>negative &&\n>  \tgit commit --cleanup=verbatim -m \"$mesg_with_comment_and_newlines\" -a &&\n> -- \n"},{"id":"209770","messageId":"20130219064304.GG19757@elie.Belkin","threadId":"32932","inReplyTo":"1361247427-438-4-git-send-email-drafnel@gmail.com","subject":"Re: [PATCH 4/4] Documentation/git-commit.txt: correct a few minor grammatical mistakes","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-19T06:43:04Z","receivedAt":"2013-02-19T06:43:04Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Casey wrote:\n\n> --- a/Documentation/git-commit.txt\n> +++ b/Documentation/git-commit.txt\n> @@ -174,10 +174,10 @@ OPTIONS\n>  --cleanup=<mode>::\n>  \tThis option sets how the commit message is cleaned up.\n>  \tThe  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n> -\tand 'default'. The 'default' mode will strip leading and\n> +\tor 'default'. The 'default' mode will strip leading and\n>  \ttrailing empty lines and #commentary from the commit message\n> -\tonly if the message is to be edited. Otherwise only whitespace\n> -\tremoved. The 'verbatim' mode does not change message at all,\n> +\tonly if the message is to be edited. Otherwise only whitespace is\n> +\tremoved. The 'verbatim' mode does not change the message at all,\n>  \t'whitespace' removes just leading/trailing whitespace lines\n>  \tand 'strip' removes both whitespace and commentary. The default\n>  \tcan be changed by the 'commit.cleanup' configuration variable\n\nYeah, the current text is a bit choppy.  How about this?\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n\n--- i/Documentation/git-commit.txt\n+++ w/Documentation/git-commit.txt\n@@ -172,16 +172,25 @@ OPTIONS\n        linkgit:git-commit-tree[1].\n \n --cleanup=<mode>::\n-\tThis option sets how the commit message is cleaned up.\n-\tThe  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n-\tand 'default'. The 'default' mode will strip leading and\n-\ttrailing empty lines and #commentary from the commit message\n-\tonly if the message is to be edited. Otherwise only whitespace\n-\tremoved. The 'verbatim' mode does not change message at all,\n-\t'whitespace' removes just leading/trailing whitespace lines\n-\tand 'strip' removes both whitespace and commentary. The default\n-\tcan be changed by the 'commit.cleanup' configuration variable\n-\t(see linkgit:git-config[1]).\n+\tThis option determines how the supplied commit message should be\n+\tcleaned up before committing. The '<mode>' can be `verbatim`,\n+\t`whitespace`, `strip`, or `default`.\n++\n+--\n+default::\n+\tStrip leading and trailing empty lines and #commentary from\n+\tthe commit message only if the message is to be edited.\n+\tOtherwise only remove whitespace.\n+verbatim::\n+\tDo not change the message at all.\n+whitespace::\n+\tRemove only leading and trailing whitespace lines.\n+strip::\n+\tRemove both whitespace and commentary.\n+--\n++\n+The default can be changed using the 'commit.cleanup' configuration\n+variable (see linkgit:git-config[1]).\n \n -e::\n --edit::\n"},{"id":"209772","messageId":"CA+sFfMf8juf0rQh6S2sW=_LmsbhPc=c+erVppsZbAw-+h-4CqQ@mail.gmail.com","threadId":"32932","inReplyTo":"20130219064304.GG19757@elie.Belkin","subject":"Re: [PATCH 4/4] Documentation/git-commit.txt: correct a few minor grammatical mistakes","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2013-02-19T07:18:46Z","receivedAt":"2013-02-19T07:18:46Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"On Mon, Feb 18, 2013 at 10:43 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Brandon Casey wrote:\n>\n>> --- a/Documentation/git-commit.txt\n>> +++ b/Documentation/git-commit.txt\n>> @@ -174,10 +174,10 @@ OPTIONS\n>>  --cleanup=<mode>::\n>>       This option sets how the commit message is cleaned up.\n>>       The  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n>> -     and 'default'. The 'default' mode will strip leading and\n>> +     or 'default'. The 'default' mode will strip leading and\n>>       trailing empty lines and #commentary from the commit message\n>> -     only if the message is to be edited. Otherwise only whitespace\n>> -     removed. The 'verbatim' mode does not change message at all,\n>> +     only if the message is to be edited. Otherwise only whitespace is\n>> +     removed. The 'verbatim' mode does not change the message at all,\n>>       'whitespace' removes just leading/trailing whitespace lines\n>>       and 'strip' removes both whitespace and commentary. The default\n>>       can be changed by the 'commit.cleanup' configuration variable\n>\n> Yeah, the current text is a bit choppy.  How about this?\n\nHmm, I think the original text was more confusing than I realized.  I\nthink we should reorder the cleanup modes, placing \"default\" last, and\nthen describe default in terms of either strip or whitespace depending\non whether an editor will be spawned.\n\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n>\n> --- i/Documentation/git-commit.txt\n> +++ w/Documentation/git-commit.txt\n> @@ -172,16 +172,25 @@ OPTIONS\n>         linkgit:git-commit-tree[1].\n>\n>  --cleanup=<mode>::\n> -       This option sets how the commit message is cleaned up.\n> -       The  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n> -       and 'default'. The 'default' mode will strip leading and\n> -       trailing empty lines and #commentary from the commit message\n> -       only if the message is to be edited. Otherwise only whitespace\n> -       removed. The 'verbatim' mode does not change message at all,\n> -       'whitespace' removes just leading/trailing whitespace lines\n> -       and 'strip' removes both whitespace and commentary. The default\n> -       can be changed by the 'commit.cleanup' configuration variable\n> -       (see linkgit:git-config[1]).\n> +       This option determines how the supplied commit message should be\n> +       cleaned up before committing. The '<mode>' can be `verbatim`,\n> +       `whitespace`, `strip`, or `default`.\n> ++\n> +--\n> +default::\n> +       Strip leading and trailing empty lines and #commentary from\n> +       the commit message only if the message is to be edited.\n> +       Otherwise only remove whitespace.\n> +verbatim::\n> +       Do not change the message at all.\n> +whitespace::\n> +       Remove only leading and trailing whitespace lines.\n> +strip::\n> +       Remove both whitespace and commentary.\n\nLet's reorder these.  Maybe something like this:\n\n+strip::\n+       Strip leading and trailing empty lines, trailing whitespace\nand #commentary and\n+       collapse consecutive blank lines into one.\n+whitespace::\n+       Same as \"strip\" except #commentary is not removed.\n+verbatim::\n+       Do not change the message at all.\n+default::\n+       \"strip\" if the message is to be edited.  Otherwise \"whitespace\".\n\n> +--\n> ++\n> +The default can be changed using the 'commit.cleanup' configuration\n> +variable (see linkgit:git-config[1]).\n>\n>  -e::\n>  --edit::\n\n-Brandon\n"},{"id":"209774","messageId":"20130219072924.GJ19757@elie.Belkin","threadId":"32932","inReplyTo":"CA+sFfMf8juf0rQh6S2sW=_LmsbhPc=c+erVppsZbAw-+h-4CqQ@mail.gmail.com","subject":"Re: [PATCH 4/4] Documentation/git-commit.txt: correct a few minor grammatical mistakes","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-19T07:29:24Z","receivedAt":"2013-02-19T07:29:24Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Casey wrote:\n\n> Hmm, I think the original text was more confusing than I realized.  I\n> think we should reorder the cleanup modes, placing \"default\" last, and\n> then describe default in terms of either strip or whitespace depending\n> on whether an editor will be spawned.\n\nSounds good to me. :)\n"},{"id":"209840","messageId":"7vhal86wt4.fsf@alter.siamese.dyndns.org","threadId":"32932","inReplyTo":"20130219050813.GC19757@elie.Belkin","subject":"Re: [PATCH 1/4] t/t7502: compare entire commit message with what was expected","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-19T17:24:55Z","receivedAt":"2013-02-19T17:24:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> The downside (not a new problem, but a downside nonetheless) is that\n> it means the test doesn't demonstrate what --cleanup=verbatim --status\n> will do.\n>\n> How about something like this?\n\nCan't we be a bit more robust by not using a hardcoded block of\nlines as the \"expect\" string?  You could for example use what you\nwould see in your editor when \"git commit\" is run without the \"-t\"\noption to form the expected pattern, no?\n\nIn any case, I think (1) a test for 'verbatim with status' is worth\ndoing, and (2) it would be cleaner to do this as a separate step,\nperhaps on top of Brandon's 4-patch series.\n\n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n>\n> diff --git i/t/t7502-commit.sh w/t/t7502-commit.sh\n> index cbd7a459..64162fce 100755\n> --- i/t/t7502-commit.sh\n> +++ w/t/t7502-commit.sh\n> @@ -180,15 +180,37 @@ test_expect_success 'verbose respects diff config' '\n>  test_expect_success 'cleanup commit messages (verbatim option,-t)' '\n>  \n>  \techo >>negative &&\n> -\t{ echo;echo \"# text\";echo; } >expect &&\n> -\tgit commit --cleanup=verbatim -t expect -a &&\n> -\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" |head -n 3 >actual &&\n> +\t{\n> +\t\techo &&\n> +\t\techo \"# text\" &&\n> +\t\techo\n> +\t} >template &&\n> +\t{\n> +\t\tcat template &&\n> +\t\tcat <<-\\EOF &&\n> +\n> +\t\t# Please enter the commit message for your changes. Lines starting\n> +\t\t# with '\\''#'\\'' will be kept; you may remove them yourself if you want to.\n> +\t\t# An empty message aborts the commit.\n> +\t\t#\n> +\t\t# Author:    A U Thor <author@example.com>\n> +\t\t#\n> +\t\tEOF\n> +\t\tgit commit -a --dry-run\n> +\t} >expect &&\n> +\tgit commit --cleanup=verbatim -t template -a &&\n> +\tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\" >actual &&\n>  \ttest_cmp expect actual\n>  \n>  '\n>  \n>  test_expect_success 'cleanup commit messages (verbatim option,-F)' '\n>  \n> +\t{\n> +\t\techo &&\n> +\t\techo \"# text\" &&\n> +\t\techo\n> +\t} >expect &&\n>  \techo >>negative &&\n>  \tgit commit --cleanup=verbatim -F expect -a &&\n>  \tgit cat-file -p HEAD |sed -e \"1,/^\\$/d\">actual &&\n"},{"id":"209841","messageId":"7va9r06we2.fsf@alter.siamese.dyndns.org","threadId":"32932","inReplyTo":"20130219072924.GJ19757@elie.Belkin","subject":"Re: [PATCH 4/4] Documentation/git-commit.txt: correct a few minor grammatical mistakes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-19T17:33:57Z","receivedAt":"2013-02-19T17:33:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Brandon Casey wrote:\n>\n>> Hmm, I think the original text was more confusing than I realized.  I\n>> think we should reorder the cleanup modes, placing \"default\" last, and\n>> then describe default in terms of either strip or whitespace depending\n>> on whether an editor will be spawned.\n>\n> Sounds good to me. :)\n\nWill take 1-3 of the series for now, as the above seems to indicate\nthat I'll see a quick reroll of 4/4.\n\nThanks both for patches and review.\n"},{"id":"209845","messageId":"1361297653-1315-1-git-send-email-bcasey@nvidia.com","threadId":"32932","inReplyTo":"7va9r06we2.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 4/4] Documentation/git-commit.txt: rework the --cleanup section","fromName":"Brandon Casey","fromEmail":"bcasey@nvidia.com","sentAt":"2013-02-19T18:14:13Z","receivedAt":"2013-02-19T18:14:13Z","isPatch":true,"sender":{"key":"bcasey@nvidia.com","avatar":null},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n\nOk, here's the updated text.  I am not set up to build the documentation,\nso I hope someone will test, but looks right to me.\n\n-Brandon\n\n\n Documentation/git-commit.txt | 28 ++++++++++++++++++----------\n 1 file changed, 18 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 0eb79cc..992c219 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -172,16 +172,24 @@ OPTIONS\n        linkgit:git-commit-tree[1].\n \n --cleanup=<mode>::\n-\tThis option sets how the commit message is cleaned up.\n-\tThe  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n-\tand 'default'. The 'default' mode will strip leading and\n-\ttrailing empty lines and #commentary from the commit message\n-\tonly if the message is to be edited. Otherwise only whitespace\n-\tremoved. The 'verbatim' mode does not change message at all,\n-\t'whitespace' removes just leading/trailing whitespace lines\n-\tand 'strip' removes both whitespace and commentary. The default\n-\tcan be changed by the 'commit.cleanup' configuration variable\n-\t(see linkgit:git-config[1]).\n+\tThis option determines how the supplied commit message should be\n+\tcleaned up before committing.  The '<mode>' can be `strip`,\n+\t`whitespace`, `verbatim`, or `default`.\n++\n+--\n+strip::\n+\tStrip leading and trailing empty lines, trailing whitespace, and\n+\t#commentary and collapse consecutive empty lines.\n+whitespace::\n+\tSame as `strip` except #commentary is not removed.\n+verbatim::\n+\tDo not change the message at all.\n+default::\n+\t`strip` if the message is to be edited.  Otherwise `whitespace`.\n+--\n++\n+\tThe default can be changed by the 'commit.cleanup' configuration\n+\tvariable (see linkgit:git-config[1]).\n \n -e::\n --edit::\n-- \n1.8.1.3.566.gaa39828\n"},{"id":"209846","messageId":"1361298516-15820-1-git-send-email-bcasey@nvidia.com","threadId":"32932","inReplyTo":"7va9r06we2.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 4/4] Documentation/git-commit.txt: rework the --cleanup section","fromName":"Brandon Casey","fromEmail":"bcasey@nvidia.com","sentAt":"2013-02-19T18:28:36Z","receivedAt":"2013-02-19T18:28:36Z","isPatch":true,"sender":{"key":"bcasey@nvidia.com","avatar":null},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n\n\n[RESEND] I originally specified Junio's address as gitster@pobox.org.\n\nOk, here's the updated text.  I am not set up to build the documentation,\nso I hope someone will test, but looks right to me.\n\n-Brandon\n\n\n Documentation/git-commit.txt | 28 ++++++++++++++++++----------\n 1 file changed, 18 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 0eb79cc..992c219 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -172,16 +172,24 @@ OPTIONS\n        linkgit:git-commit-tree[1].\n \n --cleanup=<mode>::\n-\tThis option sets how the commit message is cleaned up.\n-\tThe  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n-\tand 'default'. The 'default' mode will strip leading and\n-\ttrailing empty lines and #commentary from the commit message\n-\tonly if the message is to be edited. Otherwise only whitespace\n-\tremoved. The 'verbatim' mode does not change message at all,\n-\t'whitespace' removes just leading/trailing whitespace lines\n-\tand 'strip' removes both whitespace and commentary. The default\n-\tcan be changed by the 'commit.cleanup' configuration variable\n-\t(see linkgit:git-config[1]).\n+\tThis option determines how the supplied commit message should be\n+\tcleaned up before committing.  The '<mode>' can be `strip`,\n+\t`whitespace`, `verbatim`, or `default`.\n++\n+--\n+strip::\n+\tStrip leading and trailing empty lines, trailing whitespace, and\n+\t#commentary and collapse consecutive empty lines.\n+whitespace::\n+\tSame as `strip` except #commentary is not removed.\n+verbatim::\n+\tDo not change the message at all.\n+default::\n+\t`strip` if the message is to be edited.  Otherwise `whitespace`.\n+--\n++\n+\tThe default can be changed by the 'commit.cleanup' configuration\n+\tvariable (see linkgit:git-config[1]).\n \n -e::\n --edit::\n-- \n1.8.1.3.566.gaa39828\n"},{"id":"209847","messageId":"1361298570-19738-1-git-send-email-bcasey@nvidia.com","threadId":"32932","inReplyTo":"7va9r06we2.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 4/4] Documentation/git-commit.txt: rework the --cleanup section","fromName":"Brandon Casey","fromEmail":"bcasey@nvidia.com","sentAt":"2013-02-19T18:29:30Z","receivedAt":"2013-02-19T18:29:30Z","isPatch":true,"sender":{"key":"bcasey@nvidia.com","avatar":null},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n\n\n[RESEND] I originally specified Junio's address as gitster@pobox.org.\n[RESEND] Sorry, now with the correct address.\n\nOk, here's the updated text.  I am not set up to build the documentation,\nso I hope someone will test, but looks right to me.\n\n-Brandon\n\n\n Documentation/git-commit.txt | 28 ++++++++++++++++++----------\n 1 file changed, 18 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 0eb79cc..992c219 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -172,16 +172,24 @@ OPTIONS\n        linkgit:git-commit-tree[1].\n \n --cleanup=<mode>::\n-\tThis option sets how the commit message is cleaned up.\n-\tThe  '<mode>' can be one of 'verbatim', 'whitespace', 'strip',\n-\tand 'default'. The 'default' mode will strip leading and\n-\ttrailing empty lines and #commentary from the commit message\n-\tonly if the message is to be edited. Otherwise only whitespace\n-\tremoved. The 'verbatim' mode does not change message at all,\n-\t'whitespace' removes just leading/trailing whitespace lines\n-\tand 'strip' removes both whitespace and commentary. The default\n-\tcan be changed by the 'commit.cleanup' configuration variable\n-\t(see linkgit:git-config[1]).\n+\tThis option determines how the supplied commit message should be\n+\tcleaned up before committing.  The '<mode>' can be `strip`,\n+\t`whitespace`, `verbatim`, or `default`.\n++\n+--\n+strip::\n+\tStrip leading and trailing empty lines, trailing whitespace, and\n+\t#commentary and collapse consecutive empty lines.\n+whitespace::\n+\tSame as `strip` except #commentary is not removed.\n+verbatim::\n+\tDo not change the message at all.\n+default::\n+\t`strip` if the message is to be edited.  Otherwise `whitespace`.\n+--\n++\n+\tThe default can be changed by the 'commit.cleanup' configuration\n+\tvariable (see linkgit:git-config[1]).\n \n -e::\n --edit::\n-- \n1.8.1.3.566.gaa39828\n"},{"id":"209861","messageId":"20130219202822.GA13460@google.com","threadId":"32932","inReplyTo":"1361298570-19738-1-git-send-email-bcasey@nvidia.com","subject":"[PATCH] fixup! Documentation/git-commit.txt: rework the --cleanup section","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-02-19T20:28:23Z","receivedAt":"2013-02-19T20:28:23Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nBrandon Casey wrote:\n\n> Signed-off-by: Brandon Casey <drafnel@gmail.com>\n\nThis renders as\n\n\t--cleanup=<mode>\n\t    This option determines how the supplied commit message\n\t    should be cleaned up before committing. The <mode> can be\n\t    strip, whitespace, verbatim, or default.\n\n\t    strip\n\t\tStrip leading and trailing empty lines, trailing\n\t\twhitespace, and #commentary and collapse consecutive\n\t\tempty lines.\n\n\t    whitespace\n\t\tSame as strip except #commentary is not removed.\n\n\t    verbatim\n\t\tDo not change the message at all.\n\n\t    default\n\n\t\tstrip if the message is to be edited. Otherwise\n\t\twhitespace.\n\n\t\tThe default can be changed by the 'commit.cleanup' config\n\t\tvariable (see linkgit:git-config[1]).\n\nProblems:\n\n * There's a weird extra blank line after \"default\"\n * Wrong indentation for the final paragraph.\n * The linkgit isn't resolved for some reason.\n\nThe following fixes it for me.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/git-commit.txt | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 992c219..24a99cc 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -185,11 +185,12 @@ whitespace::\n verbatim::\n \tDo not change the message at all.\n default::\n-\t`strip` if the message is to be edited.  Otherwise `whitespace`.\n+\tSame as `strip` if the message is to be edited.\n+\tOtherwise `whitespace`.\n --\n +\n-\tThe default can be changed by the 'commit.cleanup' configuration\n-\tvariable (see linkgit:git-config[1]).\n+The default can be changed by the 'commit.cleanup' configuration\n+variable (see linkgit:git-config[1]).\n \n -e::\n --edit::\n-- \n1.8.1.3\n"},{"id":"209862","messageId":"CA+sFfMes8X4opKjz0nOrZagtnjTD=7-xf5XcrB6pZW3cBR-jqw@mail.gmail.com","threadId":"32932","inReplyTo":"20130219202822.GA13460@google.com","subject":"Re: [PATCH] fixup! Documentation/git-commit.txt: rework the --cleanup section","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2013-02-19T20:33:35Z","receivedAt":"2013-02-19T20:33:35Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"On Tue, Feb 19, 2013 at 12:28 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Hi,\n>\n> Brandon Casey wrote:\n\n> Problems:\n>\n>  * There's a weird extra blank line after \"default\"\n>  * Wrong indentation for the final paragraph.\n>  * The linkgit isn't resolved for some reason.\n>\n> The following fixes it for me.\n\nThanks Jonathan.\n\n-Brandon\n"},{"id":"209863","messageId":"7vsj4s3uub.fsf@alter.siamese.dyndns.org","threadId":"32932","inReplyTo":"1361298570-19738-1-git-send-email-bcasey@nvidia.com","subject":"Re: [PATCH v2 4/4] Documentation/git-commit.txt: rework the --cleanup section","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-19T20:35:40Z","receivedAt":"2013-02-19T20:35:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Casey <bcasey@nvidia.com> writes:\n\n> From: Brandon Casey <drafnel@gmail.com>\n>\n> Signed-off-by: Brandon Casey <drafnel@gmail.com>\n> ---\n>\n>\n> [RESEND] I originally specified Junio's address as gitster@pobox.org.\n> [RESEND] Sorry, now with the correct address.\n>\n> Ok, here's the updated text.  I am not set up to build the documentation,\n> so I hope someone will test, but looks right to me.\n\nThanks for marking this as unverified.\n\nJonathan, thanks for the fixup.\n"}]}