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

Re: Git merge conflicts and encoding of logs

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 23, 2008, 10:04 UTC
Message-ID
<7vlju7fbqu.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<4950A422.5030100@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 16 quoted lines
> Junio C Hamano schrieb:
>> <<<<<<< HEAD:foo
>> これはサイドブランチの変更です。
>> やはり JIS コードで書いてます。
>> =======
>> 日本語のファイルです。
>> JIS コードで書いてます。
>>>>>>>>> master:foo
>> 
>> The above will probably come out as UTF-8 in this mail text, but the point
>> is that the confict side markers do not have anything but filename and the
>> branch name.  I am still scratching my head trying to see where in the
>> merge-recursive codepath you got snippet of log message.
>
> Try rebase -i instead of merge: This should put summary lines onto the
> conflict markers.
Ah, that's cherry-pick.
The fix should be around the area this weather-balloon patch touches.

Note that this does not correctly work yet, and it seems that somewhere the string is truncated.

But I won't be debugging it further for now...
----
 builtin-revert.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
diff --git c/builtin-revert.c w/builtin-revert.c
index d48313c..47ff16f 100644
--- c/builtin-revert.c
+++ w/builtin-revert.c
@@ -244,6 +244,19 @@ static struct tree *empty_tree(void)
 	return tree;
 }
 
+static char *branch_label_to_output_encoding(char *oneline)
+{
+	if (git_log_output_encoding &&
+	    strcmp(git_log_output_encoding, git_commit_encoding)) {
+		char *it = reencode_string(oneline,
+					   git_log_output_encoding,
+					   git_commit_encoding);
+		if (it)
+			return it;
+	}
+	return oneline;
+}
+
 static int revert_or_cherry_pick(int argc, const char **argv)
 {
 	unsigned char head[20];
@@ -373,7 +386,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	read_cache();
 	init_merge_options(&o);
 	o.branch1 = "HEAD";
-	o.branch2 = oneline;
+	o.branch2 = branch_label_to_output_encoding(oneline);
 
 	head_tree = parse_tree_indirect(head);
 	next_tree = next ? next->tree : empty_tree();
Previous: Johannes SixtNext: Junichi Uekawa
Message 4 of 5 in “Git merge conflicts and encoding of logs”
  1. Junichi UekawaDec 23, 2008
  2. Junio C HamanoDec 23, 2008
  3. Johannes SixtDec 23, 2008
  4. Junio C HamanoDec 23, 2008
  5. Junichi UekawaDec 23, 2008

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.