From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: Git merge conflicts and encoding of logs Date: Tue, 23 Dec 2008 00:22:08 -0800 Message-ID: <7vprjjfgi7.fsf@gitster.siamese.dyndns.org> References: <87lju7h4yb.dancerj%dancer@netfort.gr.jp> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: git@vger.kernel.org To: Junichi Uekawa X-From: git-owner@vger.kernel.org Tue Dec 23 09:23:38 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1LF2YC-0003ub-T8 for gcvg-git-2@gmane.org; Tue, 23 Dec 2008 09:23:37 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbYLWIWS (ORCPT ); Tue, 23 Dec 2008 03:22:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752416AbYLWIWS (ORCPT ); Tue, 23 Dec 2008 03:22:18 -0500 Received: from a-sasl-quonix.sasl.smtp.pobox.com ([208.72.237.25]:38210 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbYLWIWR (ORCPT ); Tue, 23 Dec 2008 03:22:17 -0500 Received: from localhost.localdomain (unknown [127.0.0.1]) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 3FC1F1AE5F; Tue, 23 Dec 2008 03:22:16 -0500 (EST) Received: from pobox.com (unknown [68.225.240.211]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id A30761AE5E; Tue, 23 Dec 2008 03:22:11 -0500 (EST) In-Reply-To: <87lju7h4yb.dancerj%dancer@netfort.gr.jp> (Junichi Uekawa's message of "Tue, 23 Dec 2008 13:48:44 +0900") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-Pobox-Relay-ID: CECCDE92-D0CA-11DD-8A65-F83E113D384A-77302942!a-sasl-quonix.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: --=-=-= Content-Type: text/plain; charset=iso-2022-jp Junichi Uekawa writes: > Git merge conflict will insert '<<< first line of commit log message' > '===' '>>>' markers to the text file that is causing a conflict. > > Unfortunately, the encoding of the text file may be different from the > log message encoding, and that results in a file which has a mixed > encoding (which is pretty hard to edit from any editor BTW). > > My use case is editing platex files (iso-2022-jp encoded) with log > messages of utf-8. > > ... Thinking about it, it's probably the same encoding problem as git > blame. What 69cd8f6 (builtin-blame: Reencode commit messages according to git-log rules., 2008-10-22) does to git-blame is to re-encode the data taken from the commit log to i18n.logoutputencoding, and put that in the datastream. If your commit object have names and messages in utf-8, and if you set i18n.logoutputencoding to iso-2022-jp, that would reencode data taken from the commit object in iso-2022-jp and sprinkle them in the blame datastream. The issue would be certainly similar, *if* anything on your <<>> lines came from commit log message, but I couldn't trigger what you describe. I prepared a history of this shape: B / o---A with ISO-2022-JP payload and UTF-8 commit log message. Then, I added: [i18n] logoutputencoding = iso-2022-jp which lets me read "git log -p --all" quite comfortably. Everything comes out as good old JISX0208. So far, so good. Then while on branch B, I tried to merge A, which resulted in conflicts that looked like this: <<<<<<< 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. A bundle from my test repository is attached. You can use it to reproduce the repository like this: $ cd /var/tmp && mkdir test && cd test && git init $ git pull ../x.bndl master $ git fetch ../x.bndl side:side --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=x.bndl Content-Transfer-Encoding: base64 Content-Description: a bundle of the sample history IyB2MiBnaXQgYnVuZGxlCjQzYjk0NzQ2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