From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#23076: 24.5; vc-git: add a new variable for log output coding system Date: Sun, 10 Apr 2016 19:10:35 +0300 Message-ID: <83oa9hh2bo.fsf@gnu.org> References: <56EFE033.7080900@gmail.com> <56F04527.6010901@gmail.com> <83fuv4s4cr.fsf@gnu.org> <57017E45.7050605@gmail.com> <83pou5o0uh.fsf@gnu.org> <5708F5CA.3080509@gmail.com> <83egafhrpf.fsf@gnu.org> <57090E2F.4020702@gmail.com> <83bn5ij0sy.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1460304731 6311 80.91.229.3 (10 Apr 2016 16:12:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Apr 2016 16:12:11 +0000 (UTC) Cc: 23076@debbugs.gnu.org To: nikolay.kudryavtsev@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 10 18:12:10 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1apHy5-0006Vt-UF for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Apr 2016 18:12:10 +0200 Original-Received: from localhost ([::1]:35490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apHy4-0005ml-Jc for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Apr 2016 12:12:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apHy1-0005kz-D1 for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 12:12:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apHxy-0002Sl-6q for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 12:12:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apHxy-0002Sh-31 for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 12:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1apHxx-0005J7-Vu for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2016 12:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Apr 2016 16:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23076 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23076-submit@debbugs.gnu.org id=B23076.146030468020354 (code B ref 23076); Sun, 10 Apr 2016 16:12:01 +0000 Original-Received: (at 23076) by debbugs.gnu.org; 10 Apr 2016 16:11:20 +0000 Original-Received: from localhost ([127.0.0.1]:57393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apHxI-0005IE-4L for submit@debbugs.gnu.org; Sun, 10 Apr 2016 12:11:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41181) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apHxG-0005I2-KQ for 23076@debbugs.gnu.org; Sun, 10 Apr 2016 12:11:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apHx8-0002LZ-5v for 23076@debbugs.gnu.org; Sun, 10 Apr 2016 12:11:13 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apHx8-0002LV-2p; Sun, 10 Apr 2016 12:11:10 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3611 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1apHx7-0006wp-Fu; Sun, 10 Apr 2016 12:11:09 -0400 In-reply-to: <83bn5ij0sy.fsf@gnu.org> (message from Eli Zaretskii on Sat, 09 Apr 2016 17:48:13 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:116323 Archived-At: > Date: Sat, 09 Apr 2016 17:48:13 +0300 > From: Eli Zaretskii > Cc: 23076@debbugs.gnu.org > > > In the end, of course I like solution #2. > > Thanks, I will work on implementing it. Done, see the latest emacs-25 branch. Let me add a few comments to past discussions: > 1. Let's say your message.txt is encoded in windows-1251. Trying to commit it with "git commit -F message.txt" would result in a broken commit and this: > > Warning: commit message did not conform to UTF-8. > You may want to amend it after fixing the message, or set the config > variable i18n.commitencoding to the encoding your project uses. > > 2. Let's try doing so and set commitencoding to windows-1251 and commit again. Now we get no warning, but our message is a badly coded mess, though differently from the previous step, so it did something extra while encoding the message. That's not what I see. What I see is that the warning is gone, and "git log" produces the log message in its original encoding, i.e. windows-1251 in your case. You didn't say what kind of "badly coded mess" you saw, but one suggestion is to redirect the output of "git log" to a file, and then visit that file with windows-1251 as its encoding (i.e. "C-x RET c cp1251 RET C-x C-f THE-FILE RET"). I'm quite sure you will see your log message intact. One other thing to keep in mind is that Git apparently records the value of commitencoding which was in effect at the time of the commit, so changing the value will only affect future commits. > 3. Even when our commitencoding = windows-1251 committing message.txt in utf-8 works fine. > > So, it seems like we want to always use utf-8 for messages. My conclusion from these experiments is different. It seems like Git simply records the log messages and outputs them without any conversions or interpretation, disregarding i18n.commitEncoding. Which is consistent with the documentation: i18n.commitEncoding Character encoding the commit messages are stored in; Git itself does not care per se, but this information is necessary e.g. when importing commits from emails or in the gitk graphical history browser Note the "Git itself doesn't care" part. (I don't understand the part about importing commits from emails -- what do they mean by "important"?) I think i18n.commitEncoding is only important if i18n.logOutputEncoding is set as well, and only if it's set to a different value (or if you use the --encode option to "git log", and specify a different encoding). Then, and only then, the encoding of the log message is important, because Git will attempt to re-encode it into the output encoding. With that in mind, I eventually decided to also add a customizable option vc-git-log-output-coding-system, that should shadow the i18n.logOutputEncoding setting. Please try the latest emacs-25 branch, both without any customizations of commit and log-output encoding, and with them. I think the problems you described should now be gone, as long as you keep the values of vc-git-commits-coding-system and vc-git-log-output-coding-system in sync with the corresponding Git config values.