[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14516: 24.3.50; vc-diff ignores the encoding of its input

From: Dima Kogan
Subject: bug#14516: 24.3.50; vc-diff ignores the encoding of its input
Date: Thu, 30 May 2013 14:50:04 -0700

I'm using a very recent build of the emacs source repo on a Linux box.

I have a file that uses DOS-style line termination. This file is in git
and has some modifications. I use (vc-diff) to get a buffer that shows
those modifications. Currently this buffer is NOT set to use the DOS
encoding, and emacs does a conversion, so this buffer is missing the
extra CR characters the DOS encoding had. Because of this, if I save
this buffer to a file, external tools can no longer be used to apply the

I'm attaching a tiny git repository that demonstrates the issue:

 address@hidden:/tmp$ tar xvfz vc_encoding_error_test_repo.tar.gz

 address@hidden:/tmp$ cd vc_encoding_error_test_repo

 address@hidden:/tmp/vc_encoding_error_test_repo$ emacs --batch --eval '(progn 
(find-file "file") (vc-diff) (with-current-buffer "*vc-diff*" (write-file 
"/tmp/patch")))' -Q
 Finding changes in /tmp/vc_encoding_error_test_repo/file...
 Saving file /tmp/patch...
 Wrote /tmp/patch

 address@hidden:/tmp/vc_encoding_error_test_repo$ git apply --cached /tmp/patch
 error: patch failed: file:1
 error: file: patch does not apply

Here we see git fail to apply the saved patch. This is due to the
stripped CR characters.

VC already has code in it to detect the encoding of its input. I'm
attaching a small patch that sets this detected encoding to the
*vc-diff* buffer. This fixes the issue.

Attachment: vc_encoding_error_test_repo.tar.gz
Description: Binary data

Attachment: 0001-vc-buffers-now-use-the-encoding-of-their-input.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]