Re: Odd broken "--date=now" behavior in current git
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:04:26
Linus Torvalds [off-list ref] writes:
On Wed, Apr 15, 2015 at 12:22 AM, Eric Sunshine [off-list ref] wrote:quoted
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.