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

Re: [PATCH v3 3/3] Don't expand CRLFs when normalizing text during merge

From
Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Date
Jun 25, 2010, 07:58 UTC
Message-ID
<FB02F1B0-9FE7-4B7B-BA30-5A510F83BCE7@gmail.com>
In-Reply-To
<4C244278.10407@viscovery.net>
On 25. juni 2010, at 07.45, Johannes Sixt wrote:
Show 8 quoted lines
> Am 6/24/2010 22:44, schrieb Eyvind Bernhardsen:
>> There's no need to expand CRLFs when convert_to_working_tree() is called
>> to normalize text for a merge since the text will be converted back
>> immediately.  Improves performance of merges with conflicting line
>> endings when core.eol=crlf or core.autocrlf=true.
> 
> Pardon me, first you make a big deal about normalization for merges, only
> that you finally omit it? What am I missing?
Sorry, I didn't explain that very well.  I noticed that normalize_buffer() does more work when core.eol=crlf than it does when core.eol=lf: _to_working_tree() converts LF to CRLF, and then _to_git() reverses that conversion.  This patch makes normalization act the same way when core.eol=crlf as it does when core.eol=lf.
That implies a lack of symmetry in the way the crlf_to_git() and crlf_to_worktree() functions are called, but that asymmetry already exists when core.eol=lf since crlf_to_worktree() returns immediately when no output conversion is required.
I considered temporarily setting the "eol" and "auto_crlf" globals in normalize_buffer(), but messing with global variables felt wrong and this gives the same result (almost: it also disables conversion when a file has text=crlf, but that is a further optimization).
> BTW, most of the new functions you introduced violate the style: they
> should have the opening brace on the next line.
Ah, will fix.  Thanks.
-- 
Eyvind Bernhardsen
Previous: Johannes SixtNext: Johannes Sixt
Message 6 of 9 in “Help merging when text has been normalized”
  1. 0/3 Help merging when text has been normalizedEyvind Bernhardsen, Jun 24, 2010
  2. 1/3 Avoid conflicts when merging branches with mixed normalizationEyvind Bernhardsen, Jun 24, 2010
  3. 2/3 Try normalizing files to avoid delete/modify conflicts when mergingEyvind Bernhardsen, Jun 24, 2010
  4. 3/3 Don't expand CRLFs when normalizing text during mergeEyvind Bernhardsen, Jun 24, 2010
  5. Johannes SixtJun 25, 2010
  6. Eyvind BernhardsenJun 25, 2010
  7. Johannes SixtJun 25, 2010
  8. Eyvind BernhardsenJun 25, 2010
  9. Finn Arne GangstadJun 25, 2010

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.