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

Re: [PATCH] mergetool: respect autocrlf by using checkout-index

From
HKHannu Koivisto <azure@iki.fi>
Date
Jan 26, 2009, 16:15 UTC
Message-ID
<83skn6doxm.fsf@kalahari.s2.org>
In-Reply-To
<7v1vuuvt11.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> Charles Bailey <charles@hashpling.org> writes:
>
>> Previously, git mergetool used cat-file which does not perform git to
>> worktree conversion. This changes mergetool to use git checkout-index
>> instead which means that the temporary files used for mergetool use the
>> correct line endings for the platform.
>>
>> Signed-off-by: Charles Bailey <charles@hashpling.org>
>
> Sounds like the right thing to do and from a cursory review it looks Ok to
> me.
>
> But I do not use mergetool myself, so an Ack from Ted and a Thanks from
> whoever reported the breakage would be encouraging ;-).

I apologize for not being able to test this earlier and I'm certainly thankful for the patch, although admittedly I reported the issue mainly to help improve git, not because mergetool is part of my normal use of git (that may change when I find time to study it and see if I can easily add ediff support to it in addition to emerge).

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.

-- 
Hannu
Previous: Charles BaileyNext: Charles Bailey
Message 7 of 12 in “git diff, git mergetool and CRLF conversion”
  1. Hannu KoivistoJan 21, 2009
  2. Charles BaileyJan 21, 2009
  3. Theodore TsoJan 21, 2009
  4. mergetool: respect autocrlf by using checkout-indexCharles Bailey, Jan 21, 2009
  5. Junio C HamanoJan 23, 2009
  6. Charles BaileyJan 23, 2009
  7. Hannu KoivistoJan 26, 2009
  8. Charles BaileyJan 26, 2009
  9. Junio C HamanoJan 26, 2009
  10. Junio C HamanoJan 26, 2009
  11. Junio C HamanoJan 26, 2009
  12. Hannu KoivistoJan 27, 2009

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.