Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2] commit: allow {--amend|-c foo} when {HEAD|foo} has empty message

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:10

Thomas Rast [off-list ref] writes:
quoted hunk
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help