{"thread":{"id":"46720","subject":"[PATCH] commit-tree: don't append a newline with -F","startedAt":"2017-09-07T14:42:12Z","lastAt":"2017-09-14T17:06:55Z","messageCount":5,"participants":["Ross Kabus","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"327710","messageId":"20170907144111.7488-1-rkabus@aerotech.com","threadId":"46720","inReplyTo":null,"subject":"[PATCH] commit-tree: don't append a newline with -F","fromName":"Ross Kabus","fromEmail":"rkabus@aerotech.com","sentAt":"2017-09-07T14:41:11Z","receivedAt":"2017-09-07T14:42:12Z","isPatch":true,"sender":{"key":"rkabus@aerotech.com","avatar":"https://avatars.githubusercontent.com/u/18420751?v=4"},"body":"This change makes it such that commit-tree -F never appends a newline\ncharacter to the supplied commit message (either from file or stdin).\n\nPreviously, commit-tree -F would always append a newline character to\nthe text brought in from file or stdin. This has caused confusion in a\nnumber of ways:\n  - This is a plumbing command and it is generally expected not to do\n    text cleanup or other niceties.\n  - stdin piping with \"-F -\" appends a newline but stdin piping without\n    -F does not append a newline (inconsistent).\n  - git-commit does not specifically append a newline to the \"-F\"\n    input. The issue is somewhat muddled by the fact that git-commit\n    does pass the message through its --cleanup option, which may add\n    such a newline. But for commit-tree to match \"commit --cleanup=verbatim\",\n    we should not do so here.\n\nSigned-off-by: Ross Kabus <rkabus@aerotech.com>\n---\n builtin/commit-tree.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex 19e898fa4..2177251e2 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -102,7 +102,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n \t\t\tif (fd && close(fd))\n \t\t\t\tdie_errno(\"git commit-tree: failed to close '%s'\",\n \t\t\t\t\t  argv[i]);\n-\t\t\tstrbuf_complete_line(&buffer);\n \t\t\tcontinue;\n \t\t}\n \n-- \n2.13.1.windows.2\n\n"},{"id":"327740","messageId":"xmqqa8260y7g.fsf@gitster.mtv.corp.google.com","threadId":"46720","inReplyTo":"20170907144111.7488-1-rkabus@aerotech.com","subject":"Re: [PATCH] commit-tree: don't append a newline with -F","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-09-08T01:35:15Z","receivedAt":"2017-09-08T01:35:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ross Kabus <rkabus@aerotech.com> writes:\n\n> This change makes it such that commit-tree -F never appends a newline\n> character to the supplied commit message (either from file or stdin).\n>\n> Previously, commit-tree -F would always append a newline character to\n> the text brought in from file or stdin.\n\nThis is not correct.  The command adds a missing newline only when\nthe input ended in an incompete line.\n\nI'd rephrase the whole thing like this:\n\n    commit-tree: do not complete line in -F input\n\n    \"git commit-tree -F <file>\", unlike \"cat <file> | git\n    commit-tree\" (i.e. feeding the same contents from the standard\n    input), added a missing final newline when the input ended in an\n    incomplete line.\n\n    Correct this inconsistency by leaving the incomplete line as-is,\n    as erring on the side of not touching the input is preferrable\n    and expected for a plumbing command like \"commit-tree\".\n\nif I were doing this patch.\n\nThanks.\n\n> Signed-off-by: Ross Kabus <rkabus@aerotech.com>\n> ---\n>  builtin/commit-tree.c | 1 -\n>  1 file changed, 1 deletion(-)\n>\n> diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\n> index 19e898fa4..2177251e2 100644\n> --- a/builtin/commit-tree.c\n> +++ b/builtin/commit-tree.c\n> @@ -102,7 +102,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n>  \t\t\tif (fd && close(fd))\n>  \t\t\t\tdie_errno(\"git commit-tree: failed to close '%s'\",\n>  \t\t\t\t\t  argv[i]);\n> -\t\t\tstrbuf_complete_line(&buffer);\n>  \t\t\tcontinue;\n>  \t\t}\n"},{"id":"327796","messageId":"CAEVs+zYrKxX0S9LMoBLB3vqG5n3PuMGMCehipbpCmFA7dW95qw@mail.gmail.com","threadId":"46720","inReplyTo":"xmqqa8260y7g.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] commit-tree: don't append a newline with -F","fromName":"Ross Kabus","fromEmail":"rkabus@aerotech.com","sentAt":"2017-09-08T22:06:00Z","receivedAt":"2017-09-08T22:06:51Z","isPatch":true,"sender":{"key":"rkabus@aerotech.com","avatar":"https://avatars.githubusercontent.com/u/18420751?v=4"},"body":"On Thu, Sep 7, 2017 at 9:35 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>     commit-tree: do not complete line in -F input\n>\n>     \"git commit-tree -F <file>\", unlike \"cat <file> | git\n>     commit-tree\" (i.e. feeding the same contents from the standard\n>     input), added a missing final newline when the input ended in an\n>     incomplete line.\n>\n>     Correct this inconsistency by leaving the incomplete line as-is,\n>     as erring on the side of not touching the input is preferrable\n>     and expected for a plumbing command like \"commit-tree\".\n\nThat all makes sense to me and is clearer too, I like this change.\nDo I need to resubmit the patch or will you just use that text instead?\n"},{"id":"327798","messageId":"xmqqmv64y2sf.fsf@gitster.mtv.corp.google.com","threadId":"46720","inReplyTo":"CAEVs+zYrKxX0S9LMoBLB3vqG5n3PuMGMCehipbpCmFA7dW95qw@mail.gmail.com","subject":"Re: [PATCH] commit-tree: don't append a newline with -F","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-09-09T03:22:08Z","receivedAt":"2017-09-09T03:22:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ross Kabus <rkabus@aerotech.com> writes:\n\n> On Thu, Sep 7, 2017 at 9:35 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>     commit-tree: do not complete line in -F input\n>>\n>>     \"git commit-tree -F <file>\", unlike \"cat <file> | git\n>>     commit-tree\" (i.e. feeding the same contents from the standard\n>>     input), added a missing final newline when the input ended in an\n>>     incomplete line.\n>>\n>>     Correct this inconsistency by leaving the incomplete line as-is,\n>>     as erring on the side of not touching the input is preferrable\n>>     and expected for a plumbing command like \"commit-tree\".\n>\n> That all makes sense to me and is clearer too, I like this change.\n> Do I need to resubmit the patch or will you just use that text instead?\n\nUnless the change is in the middle of a large series or require more\ninvolved edit [*1*], it is perfectly fine to tell me the maintainer\nto do these small menial changes on behalf of you---you explicitly\nneed to tell me what you want to happen, though.\n\nThanks.\n\n[Footnote]\n\n*1* ... in which case we have a larger chance of the maintainer\n    screwing up while attempting to do so, and I'd prefer to see an\n    updated version posted on the list.  That way, we can benefit\n    from extra set of eyeballs watching our exchange from the\n    sideline.\n\n"},{"id":"328067","messageId":"20170914170521.8076-1-rkabus@aerotech.com","threadId":"46720","inReplyTo":"xmqqa8260y7g.fsf@gitster.mtv.corp.google.com","subject":"[PATCH v2] commit-tree: do not complete line in -F input","fromName":"Ross Kabus","fromEmail":"rkabus@aerotech.com","sentAt":"2017-09-14T17:05:21Z","receivedAt":"2017-09-14T17:06:55Z","isPatch":true,"sender":{"key":"rkabus@aerotech.com","avatar":"https://avatars.githubusercontent.com/u/18420751?v=4"},"body":"\"git commit-tree -F <file>\", unlike \"cat <file> | git\ncommit-tree\" (i.e. feeding the same contents from the standard\ninput), added a missing final newline when the input ended in an\nincomplete line.\n\nCorrect this inconsistency by leaving the incomplete line as-is,\nas erring on the side of not touching the input is preferable\nand expected for a plumbing command like \"commit-tree\".\n\nSigned-off-by: Ross Kabus <rkabus@aerotech.com>\n---\nFixed up commit message with feedback from Junio.\n\n builtin/commit-tree.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex 19e898fa4..2177251e2 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -102,7 +102,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)\n \t\t\tif (fd && close(fd))\n \t\t\t\tdie_errno(\"git commit-tree: failed to close '%s'\",\n \t\t\t\t\t  argv[i]);\n-\t\t\tstrbuf_complete_line(&buffer);\n \t\t\tcontinue;\n \t\t}\n \n-- \n2.13.1.windows.2\n\n"}]}