git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-fmt-merge-message problem..

From
Junio C Hamano <junkio@cox.net>
Date
Jul 13, 2006, 05:21 UTC
Message-ID
<7vhd1mw05a.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vlkqyw0om.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 9 quoted lines
> Linus Torvalds <torvalds@osdl.org> writes:
>
>> which makes no sense AT ALL. It's doesn't even parse. "Merge commit <repo> 
>> of <branch>"? Whaa? That's just insane.
>>
>> Also, the " * HEAD" is just ugly. It was better before.
>
> Yes, this is a simple mistranslation from Perl to C.  A patch
> will follow shortly.

-- >8 -- [PATCH] fmt-merge-msg fix

The new C version mistranslated the original Perl version in the case to pull from the HEAD. This made it to say nonsense like this:

	Merge commit ...url... of HEAD
        * HEAD:
        ...
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 builtin-fmt-merge-msg.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 6527482..fe0ef44 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -76,6 +76,7 @@ static int handle_line(char *line)
 	unsigned char *sha1;
 	char *src, *origin;
 	struct src_data *src_data;
+	int pulling_head = 0;
 
 	if (len < 43 || line[40] != '\t')
 		return 1;
@@ -101,8 +102,11 @@ static int handle_line(char *line)
 	if (src) {
 		*src = 0;
 		src += 4;
-	} else
-		src = "HEAD";
+		pulling_head = 0;
+	} else {
+		src = line;
+		pulling_head = 1;
+	}
 
 	i = find_in_list(&srcs, src);
 	if (i < 0) {
@@ -112,7 +116,10 @@ static int handle_line(char *line)
 	}
 	src_data = srcs.payload[i];
 
-	if (!strncmp(line, "branch ", 7)) {
+	if (pulling_head) {
+		origin = strdup(src);
+		src_data->head_status |= 1;
+	} else if (!strncmp(line, "branch ", 7)) {
 		origin = strdup(line + 7);
 		append_to_list(&src_data->branch, origin, NULL);
 		src_data->head_status |= 2;
@@ -124,9 +131,6 @@ static int handle_line(char *line)
 		origin = strdup(line + 14);
 		append_to_list(&src_data->r_branch, origin, NULL);
 		src_data->head_status |= 2;
-	} else if (!strcmp(line, "HEAD")) {
-		origin = strdup(src);
-		src_data->head_status |= 1;
 	} else {
 		origin = strdup(src);
 		append_to_list(&src_data->generic, strdup(line), NULL);
Previous: Junio C HamanoNext: Linus Torvalds
Message 3 of 6 in “git-fmt-merge-message problem..”
  1. Linus TorvaldsJul 13, 2006
  2. Junio C HamanoJul 13, 2006
  3. Junio C HamanoJul 13, 2006
  4. Linus TorvaldsJul 13, 2006
  5. Junio C HamanoJul 13, 2006
  6. Johannes SchindelinJul 13, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.