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

Re: [PATCH] Respect core.autocrlf when preparing temporary files for external diff

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2009, 21:59 UTC
Message-ID
<7vljqxcj84.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<bdca99240903220830u50999dfcnee0f0091b4dec835@mail.gmail.com>
Sebastian Schuberth <sschuberth@gmail.com> writes:
Show 5 quoted lines
> Me being the reporter of the original msysGit issue #177, I'd like to
> clarify that my intention not necessarily was to make
> "core.autocrlf=true" affect temporary files (i.e. to "smudge" them),
> but to ensure that the files fed into "git diff" are always generated
> / acquired in a consistent way, so that they are in fact comparable.

Thanks. I think everybody involved in the thread is in agreement with that.

> I'd also be happy with a solution that always feeds clean files into
> "git diff", although that would probably mean that we could not reuse
> working tree files if "core.autocrlf=true" is set.

When we generate diff internally, even when we borrow from the work tree, we clean it before using. See diff_populate_filespec(), ll.1900-1915.

Borrowing done by diff_tempfile(), which currently does not run clean, and the call to prep_temp_blob() in ll.2030-2035 that gives a temporary file without convert_to_working_tree() are inconsistent, as pointed out by you and Dscho.

If you run "git diff <filename>" after cloning, I expect that no temporary files are involved, _unless_ you have some settings that force "git diff" not to use the internal diff. Do you use GIT_EXTERNAL_DIFF? Do you use "textconv" attribute? What external program do you invoke from these mechanisms, and what does it expect to see as its input?

The discussion in the last few messages in this thread speculates that the external programs are more likely to expect representations suitable in the work tree, aka "smudged", than "clean" one. It would be nice to get a datapoint from you as the original reporter to confirm or refute that speculation.

Previous: Sebastian SchuberthNext: Sebastian Schuberth
Message 11 of 14 in “Respect core.autocrlf when preparing temporary files for external diff”
  1. Respect core.autocrlf when preparing temporary files for external diffJohannes Schindelin, Mar 21, 2009
  2. Michael J GruberMar 21, 2009
  3. Junio C HamanoMar 21, 2009
  4. Johannes SchindelinMar 21, 2009
  5. Junio C HamanoMar 22, 2009
  6. Junio C HamanoMar 22, 2009
  7. Jeff KingMar 22, 2009
  8. Junio C HamanoMar 22, 2009
  9. Jeff KingMar 22, 2009
  10. Sebastian SchuberthMar 22, 2009
  11. Junio C HamanoMar 22, 2009
  12. Sebastian SchuberthMar 22, 2009
  13. Junio C HamanoMar 22, 2009
  14. Junio C HamanoMar 23, 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.