All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Odd broken "--date=now" behavior in current git
Date: Wed, 15 Apr 2015 10:04:55 -0700	[thread overview]
Message-ID: <xmqqzj69l3uw.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CA+55aFwbEnneEvUDhxGaWw=fSwY2WbtGy6Uc3aQzpiUY6GH1uQ@mail.gmail.com> (Linus Torvalds's message of "Wed, 15 Apr 2015 09:20:36 -0700")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Wed, Apr 15, 2015 at 12:22 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>
>> The fix seems to be simply:
>
> Yup, that seems to do it for me. I'm not sure how we get to
> "match_digit()" with the time string "now", though.

The --date=<when> parameter is read by determine_author_info() and
then parse_force_date(), both in builtin/commit.c.  This calls
parse_date(), which first calls (and fails) parse_date_basic() when
it is not a strict timestamp.

"now", "4.days.ago", etc. are then passed to approxidate_careful()
which in turn calls approxidate_str().  Note that the approxidate
formats do not usually spell out the TZ offset.  The result is
turned into "@<numseconds>" by parse_force_date().

The string "@<numseconds>" without TZ offset is re-interpreted by
parse_date() called by fmt_ident(); the last function prepares the
author ident line "Name <email> <numseconds> <offset>".

The --date=<when> does not force committer information, which goes
through the usual codepath of grabbing the "current" time.

  reply	other threads:[~2015-04-15 17:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15  4:18 Odd broken "--date=now" behavior in current git Linus Torvalds
2015-04-15  4:47 ` Junio C Hamano
2015-04-15  7:22   ` Eric Sunshine
2015-04-15 14:42     ` Junio C Hamano
2015-04-15 16:21       ` [PATCH 1/2] parse_date_basic(): return early when given a bogus timestamp Junio C Hamano
2015-04-15 16:24       ` [PATCH 2/2] parse_date_basic(): let the system handle DST conversion Junio C Hamano
2015-04-15 17:23         ` Eric Sunshine
2015-04-15 16:20     ` Odd broken "--date=now" behavior in current git Linus Torvalds
2015-04-15 17:04       ` Junio C Hamano [this message]
2015-04-15  7:07 ` Peter Krefting

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=xmqqzj69l3uw.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.