Re: [BUG] minor: wrong handling of GIT_AUTHOR_DATE

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

 



Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:

> [ Those four deleted lines I removed just because the cases had already 
>   been handled, eg the ">1900" case was already handled when we checked 
>   for a four-digit year, and the >70 case was handled when we checked for 
>   exactly two digits ]
>
> Hmm?

> @@ -488,10 +504,6 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
>  
>  	if (num > 0 && num < 32) {
>  		tm->tm_mday = num;
> -	} else if (num > 1900) {
> -		tm->tm_year = num - 1900;
> -	} else if (num > 70) {
> -		tm->tm_year = num;
>  	} else if (num > 0 && num < 13) {
>  		tm->tm_mon = num-1;
>  	}

The comment above this part says we always favor mday over mon, but I
wonder why this sequence is not like:

	if (tm->tm_mday is not set && num > 0 && num < 32)
		tm->tm_mday = num;
	else if (tm->tm_mon is not set && num > 0 && num < 13)
		tm->tm_mon = num - 1;

Is this because we do not initialize tm fields to "unknown" in the
beginning?  I admit I haven't bothered to look at this part of the code
for a looong time.

--
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]

  Powered by Linux