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

Re: [PATCH v2] autocrlf: Make it work also for un-normalized repositories

From
Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Date
May 12, 2010, 06:33 UTC
Message-ID
<75EA5FF3-4F82-4261-AF2A-D6E7182EECE5@gmail.com>
In-Reply-To
<20100512061646.GL14069@dpotapov.dyndns.org>
On 12. mai 2010, at 08.16, Dmitry Potapov <dpotapov@gmail.com> wrote:
Show 24 quoted lines
> On Wed, May 12, 2010 at 12:37:57AM +0200, Finn Arne Gangstad wrote:
>> @@ -203,6 +247,11 @@ static int crlf_to_worktree(const char *path,  
>> const char *src, size_t len,
>>        return 0;
>>
>>    if (action == CRLF_GUESS) {
>> +        /* If we have any CR or CRLF line endings, we do not touch  
>> it */
>> +        /* This is the new safer autocrlf-handling */
>> +        if (stats.cr > 0 || stats.crlf > 0)
>> +            return 0;
>> +
>>        /* If we have any bare CR characters, we're not going to  
>> touch it */
>>        if (stats.cr != stats.crlf)
>>            return 0;
>
> If there is no CR then there is no CRLF and certainly no bare CR
> characters. So, all above checks can be replaced with one:
>
>        if (stats.cr > 0)
>            return 0;
>
> Other than that, I really like your patch.

Keeping the tests separate helps merging with my patch. The idea is to not do the "safe autocrlf" test when crlf=auto, so in that case the CR test is still needed.

-- 
Eyvind
Previous: Dmitry PotapovNext: Hnerik Grubbström
Message 3 of 5 in “autocrlf: Make it work also for un-normalized repositories”
  1. autocrlf: Make it work also for un-normalized repositoriesFinn Arne Gangstad, May 11, 2010
  2. Dmitry PotapovMay 12, 2010
  3. Eyvind BernhardsenMay 12, 2010
  4. Hnerik GrubbströmMay 12, 2010
  5. Clemens BuchacherMay 23, 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.