From: Charles Bailey <charles@hashpling.org>
To: Hannu Koivisto <azure@iki.fi>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Theodore Tso <tytso@mit.edu>
Subject: Re: [PATCH] mergetool: respect autocrlf by using checkout-index
Date: Mon, 26 Jan 2009 16:31:14 +0000 [thread overview]
Message-ID: <20090126163114.GD32604@hashpling.org> (raw)
In-Reply-To: <83skn6doxm.fsf@kalahari.s2.org>
On Mon, Jan 26, 2009 at 06:15:01PM +0200, Hannu Koivisto wrote:
>
> Now that I tried the patch, I observed that while the stage2 and
> stage3 temporary files have CRLF line endings, the merge result
> buffer/file has LF line endings. I'm again using Cygwin git,
> mergetool -t emerge and native Windows Emacs. So when I quit the
> mergetool, I get
>
> ...
> Hit return to start merge resolution tool (emerge):
> warning: LF will be replaced by CRLF in kala.txt
> warning: LF will be replaced by CRLF in kala.txt
>
> and indeed hexdump proves that the file in my worktree now has LF
> line endings even though it had CRLF line endings before invoking
> mergetool.
>
> I wonder why I didn't notice this the first time. I can certainly
> reproduce it now without Charles' patch as well so I suppose this
> is a separate issue and the patch does what it is supposed to do.
mergetool doesn't touch the destination file, it just asks the merge
tool to overwrite it.
I suspect that the LF endings in the file is due to the fact that in
builtin-merge-file.c, the file is opened (fopen) in binary mode
("wb"), but xdl_merge terminates all lines with a raw '\n'.
The obvious fix would be to change fopen in builtin-file-merge.c to
use "w" instead, but this doesn't work in a number of scenarios. In
particular, it is wrong for repositories on windows with core.autocrlf
set to false, and would not fix non-windows repositories with
core.autocrlf set to true.
Currently, I've no idea as to what the solution should be.
--
Charles Bailey
http://ccgi.hashpling.plus.com/blog/
next prev parent reply other threads:[~2009-01-26 16:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 16:55 git diff, git mergetool and CRLF conversion Hannu Koivisto
2009-01-21 17:23 ` Charles Bailey
2009-01-21 21:03 ` Theodore Tso
2009-01-21 22:57 ` [PATCH] mergetool: respect autocrlf by using checkout-index Charles Bailey
2009-01-23 17:20 ` Junio C Hamano
2009-01-23 18:18 ` Charles Bailey
2009-01-26 16:15 ` Hannu Koivisto
2009-01-26 16:31 ` Charles Bailey [this message]
2009-01-26 21:28 ` Junio C Hamano
2009-01-26 22:08 ` Junio C Hamano
2009-01-26 23:09 ` Junio C Hamano
2009-01-27 13:58 ` Hannu Koivisto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090126163114.GD32604@hashpling.org \
--to=charles@hashpling.org \
--cc=azure@iki.fi \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.