From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Anders Kaseorg <andersk@ksplice.com>, git@vger.kernel.org
Subject: Re: [PATCH] apply: Recognize epoch timestamps with : in the timezone
Date: Wed, 13 Oct 2010 11:59:05 -0700 [thread overview]
Message-ID: <7v4ocpncli.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20100929214107.GA4485@capella.cs.uchicago.edu> (Jonathan Nieder's message of "Wed\, 29 Sep 2010 16\:41\:08 -0500")
Jonathan Nieder <jrnieder@gmail.com> writes:
> Hi Anders,
>
> Anders Kaseorg wrote:
>> Some patches have a timezone formatted like '-08:00' instead of
>> '-0800' (e.g. http://lwn.net/Articles/131729/)
>
> Odd. Any idea what tool generates these patches?
>
>> --- a/builtin/apply.c
>> +++ b/builtin/apply.c
> [...]
>> @@ -765,7 +765,9 @@ static int has_epoch_timestamp(const char *nameline)
>> }
>>
>> zoneoffset = strtol(timestamp + m[3].rm_so + 1, NULL, 10);
>> - zoneoffset = (zoneoffset / 100) * 60 + (zoneoffset % 100);
>> + if (m[4].rm_so == m[3].rm_so + 3)
>> + zoneoffset /= 100;
>> + zoneoffset = zoneoffset * 60 + strtol(timestamp + m[4].rm_so, NULL, 10);
>
> Might be clearer to write
>
> if (timestamp[m[3].rm_so + 3] != ':')
Neither the patch nor your suggestion makes much sense to me. With the
patch, the regexp is now
^(1969-12-31|1970-01-01) <time>(\.0+)? ([-+][0-2][0-9]):?([0-5][0-9])
so $3 is always 3 letters long (i.e. hour with sign), no? IOW, zoneoffset
is never divided by 100 by the original patch.
What am I missing?
next prev parent reply other threads:[~2010-10-13 18:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-29 20:49 [PATCH] apply: Recognize epoch timestamps with : in the timezone Anders Kaseorg
2010-09-29 21:41 ` Jonathan Nieder
2010-09-29 21:49 ` Jonathan Nieder
2010-10-13 18:59 ` Junio C Hamano [this message]
2010-10-13 19:31 ` Junio C Hamano
2010-10-13 22:50 ` Jonathan Nieder
2010-10-13 23:37 ` Junio C Hamano
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=7v4ocpncli.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=andersk@ksplice.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.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).