Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Hermann Gausterer <git-mailinglist@mrq1.org>,
	Git Mailinglist <git@vger.kernel.org>
Subject: Re: [BUG] minor: wrong handling of GIT_AUTHOR_DATE
Date: Sat, 16 Aug 2008 22:27:23 -0700	[thread overview]
Message-ID: <7vljyw9pok.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.1.10.0808162054050.3324@nehalem.linux-foundation.org> (Linus Torvalds's message of "Sat, 16 Aug 2008 21:25:40 -0700 (PDT)")

Linus Torvalds <torvalds@linux-foundation.org> 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.

  parent reply	other threads:[~2008-08-17  5:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-16 20:53 [BUG] minor: wrong handling of GIT_AUTHOR_DATE Hermann Gausterer
2008-08-16 23:03 ` Linus Torvalds
2008-08-16 23:17   ` Linus Torvalds
2008-08-17  2:46     ` Junio C Hamano
2008-08-17  3:13       ` Junio C Hamano
2008-08-17  4:25         ` Linus Torvalds
2008-08-17  4:37           ` Linus Torvalds
2008-08-17  5:27           ` Junio C Hamano [this message]
2008-08-17 16:07             ` Linus Torvalds
2008-08-17  3:50       ` Linus Torvalds

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=7vljyw9pok.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git-mailinglist@mrq1.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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