Re: [PATCH v2] commit: allow {--amend|-c foo} when {HEAD|foo} has empty message
Thomas Rast <trast@student.ethz.ch> writes:
Show 11 quoted lines
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 3714582..5e9a832 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -690,7 +690,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
> hook_arg1 = "message";
> } else if (use_message) {
> buffer = strstr(use_message_buffer, "\n\n");
> - if (!buffer || buffer[2] == '\0')
> + if (!buffer)
> + die(_("commit object has invalid format"));In line with my previous comment, I think this should be more like:
if (!buffer) {
static char v_o_i_d[] = "\n\n";
buffer = v_o_i_d;
warning(_("commit lacks end-of-header. A broken Git emulation?"");
}The warning is of course optional.