Re: [PATCH] commit-tree: don't append a newline with -F
- Date: Fri, 08 Sep 2017 10:35:15 +0900
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: [PATCH] commit-tree: don't append a newline with -F
Ross Kabus <rkabus@xxxxxxxxxxxx> writes:
> This change makes it such that commit-tree -F never appends a newline
> character to the supplied commit message (either from file or stdin).
> Previously, commit-tree -F would always append a newline character to
> the text brought in from file or stdin.
This is not correct. The command adds a missing newline only when
the input ended in an incompete line.
I'd rephrase the whole thing like this:
commit-tree: do not complete line in -F input
"git commit-tree -F <file>", unlike "cat <file> | git
commit-tree" (i.e. feeding the same contents from the standard
input), added a missing final newline when the input ended in an
Correct this inconsistency by leaving the incomplete line as-is,
as erring on the side of not touching the input is preferrable
and expected for a plumbing command like "commit-tree".
if I were doing this patch.
> Signed-off-by: Ross Kabus <rkabus@xxxxxxxxxxxx>
> builtin/commit-tree.c | 1 -
> 1 file changed, 1 deletion(-)
> diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
> index 19e898fa4..2177251e2 100644
> --- a/builtin/commit-tree.c
> +++ b/builtin/commit-tree.c
> @@ -102,7 +102,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
> if (fd && close(fd))
> die_errno("git commit-tree: failed to close '%s'",
> - strbuf_complete_line(&buffer);