git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
To: Dmitry Potapov <dpotapov@gmail.com>
Cc: Finn Arne Gangstad <finnag@pvv.org>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	"msysgit@googlegroups.com" <msysgit@googlegroups.com>,
	Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH v2] autocrlf: Make it work also for un-normalized repositories
Date: Wed, 12 May 2010 08:33:22 +0200	[thread overview]
Message-ID: <75EA5FF3-4F82-4261-AF2A-D6E7182EECE5@gmail.com> (raw)
In-Reply-To: <20100512061646.GL14069@dpotapov.dyndns.org>

On 12. mai 2010, at 08.16, Dmitry Potapov <dpotapov@gmail.com> wrote:

> 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

  reply	other threads:[~2010-05-12  6:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11 22:37 [PATCH v2] autocrlf: Make it work also for un-normalized repositories Finn Arne Gangstad
2010-05-12  6:16 ` Dmitry Potapov
2010-05-12  6:33   ` Eyvind Bernhardsen [this message]
2010-05-12  9:26 ` Hnerik Grubbström
2010-05-23  9:30 ` Clemens Buchacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75EA5FF3-4F82-4261-AF2A-D6E7182EECE5@gmail.com \
    --to=eyvind.bernhardsen@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dpotapov@gmail.com \
    --cc=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=msysgit@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).