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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


Thanks,
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]