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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 26, 2009, 21:28 UTC
Message-ID
<7v7i4h4v19.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090126163114.GD32604@hashpling.org>
Charles Bailey <charles@hashpling.org> writes:
Show 11 quoted lines
> 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.

"git file-merge" is designed to be a replacement for stock RCS merge, and unfortunately it does not call convert_to_working_tree(), nor has any way to know for which path it should take the attributes to apply to affect what convert_to_working_tree() should do even if it were to call it.

I think we would need a new option to the command that says "pretend this is about merging this path, and use the gitattributes specified for it when writing out the result."

Previous: Charles BaileyNext: Junio C Hamano
Message 9 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.