<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/date.c, branch v2.3.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.3.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.3.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-01-07T21:01:16Z</updated>
<entry>
<title>Merge branch 'jk/approxidate-avoid-y-d-m-over-future-dates'</title>
<updated>2015-01-07T21:01:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-01-07T21:01:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=04950c714107345c92c5287bcef8f1eab7318391'/>
<id>urn:sha1:04950c714107345c92c5287bcef8f1eab7318391</id>
<content type='text'>
Traditionally we tried to avoid interpreting date strings given by
the user as future dates, e.g. GIT_COMMITTER_DATE=2014-12-10 when
used early November 2014 was taken as "October 12, 2014" because it
is likely that a date in the future, December 10, is a mistake.

Loosen this and do not tiebreak by future-ness of the date when

(1) ISO-like format is used, and
(2) the string can make sense interpreted as both y-m-d and y-d-m.

* jk/approxidate-avoid-y-d-m-over-future-dates:
  approxidate: allow ISO-like dates far in the future
  pass TIME_DATE_NOW to approxidate future-check
</content>
</entry>
<entry>
<title>approxidate: allow ISO-like dates far in the future</title>
<updated>2014-11-13T22:40:47Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-11-13T21:43:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d37239536ce960af9292fdf297e7c277303e95be'/>
<id>urn:sha1:d37239536ce960af9292fdf297e7c277303e95be</id>
<content type='text'>
When we are parsing approxidate strings and we find three
numbers separate by one of ":/-.", we guess that it may be a
date. We feed the numbers to match_multi_number, which
checks whether it makes sense as a date in various orderings
(e.g., dd/mm/yy or mm/dd/yy, etc).

One of the checks we do is to see whether it is a date more
than 10 days in the future. This was added in 38035cf (date
parsing: be friendlier to our European friends.,
2006-04-05), and lets us guess that if it is currently April
2014, then "10/03/2014" is probably March 10th, not October
3rd.

This has a downside, though; if you want to be overly
generous with your "--until" date specification, we may
wrongly parse "2014-12-01" as "2014-01-12" (because the
latter is an in-the-past date). If the year is a future year
(i.e., both are future dates), it gets even weirder. Due to
the vagaries of approxidate, months _after_ the current date
(no matter the year) get flipped, but ones before do not.

This patch drops the "in the future" check for dates of this
form, letting us treat them always as yyyy-mm-dd, even if
they are in the future. This does not affect the normal
dd/mm/yyyy versus mm/dd/yyyy lookup, because this code path
only kicks in when the first number is greater than 70
(i.e., it must be a year, and cannot be either a date or a
month).

The one possible casualty is that "yyyy-dd-mm" is less
likely to be chosen over "yyyy-mm-dd". That's probably OK,
though because:

  1. The difference happens only when the date is in the
     future. Already we prefer yyyy-mm-dd for dates in the
     past.

  2. It's unclear whether anybody even uses yyyy-dd-mm
     regularly. It does not appear in lists of common date
     formats in Wikipedia[1,2].

  3. Even if (2) is wrong, it is better to prefer ISO-like
     dates, as that is consistent with what we use elsewhere
     in git.

[1] http://en.wikipedia.org/wiki/Date_and_time_representation_by_country
[2] http://en.wikipedia.org/wiki/Calendar_date

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pass TIME_DATE_NOW to approxidate future-check</title>
<updated>2014-11-13T20:57:28Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-11-13T11:04:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=073281e2aea7177e27de8a46c5463e2f83833412'/>
<id>urn:sha1:073281e2aea7177e27de8a46c5463e2f83833412</id>
<content type='text'>
The approxidate functions accept an extra "now" parameter to
avoid calling time() themselves. We use this in our test
suite to make sure we have a consistent time for computing
relative dates. However, deep in the bowels of approxidate,
we also call time() to check whether possible dates are far
in the future. Let's make sure that the "now" override makes
it to that spot, too, so we can consistently test that
feature.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/commit-author-parsing'</title>
<updated>2014-09-19T18:38:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ff700ebacffc8fb8cf80daabfb6503cb24dca0b'/>
<id>urn:sha1:9ff700ebacffc8fb8cf80daabfb6503cb24dca0b</id>
<content type='text'>
Code clean-up.

* jk/commit-author-parsing:
  determine_author_info(): copy getenv output
  determine_author_info(): reuse parsing functions
  date: use strbufs in date-formatting functions
  record_author_date(): use find_commit_header()
  record_author_date(): fix memory leak on malformed commit
  commit: provide a function to find a header in a buffer
</content>
</entry>
<entry>
<title>pretty: provide a strict ISO 8601 date format</title>
<updated>2014-08-29T19:37:02Z</updated>
<author>
<name>Beat Bolli</name>
<email>bbolli@ewanet.ch</email>
</author>
<published>2014-08-29T16:58:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf'/>
<id>urn:sha1:466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf</id>
<content type='text'>
Git's "ISO" date format does not really conform to the ISO 8601
standard due to small differences, and it cannot be parsed by ISO
8601-only parsers, e.g. those of XML toolchains.

The output from "--date=iso" deviates from ISO 8601 in these ways:

  - a space instead of the `T` date/time delimiter
  - a space between time and time zone
  - no colon between hours and minutes of the time zone

Add a strict ISO 8601 date format for displaying committer and
author dates.  Use the '%aI' and '%cI' format specifiers and add
'--date=iso-strict' or '--date=iso8601-strict' date format names.

See http://thread.gmane.org/gmane.comp.version-control.git/255879 and
http://thread.gmane.org/gmane.comp.version-control.git/52414/focus=52585
for discussion.

Signed-off-by: Beat Bolli &lt;bbolli@ewanet.ch&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>date: use strbufs in date-formatting functions</title>
<updated>2014-08-27T17:32:56Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-08-27T07:57:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c33ddc2e33d51da9391a81206a1d9e4a92d97d10'/>
<id>urn:sha1:c33ddc2e33d51da9391a81206a1d9e4a92d97d10</id>
<content type='text'>
Many of the date functions write into fixed-size buffers.
This is a minor pain, as we have to take special
precautions, and frequently end up copying the result into a
strbuf or heap-allocated buffer anyway (for which we
sometimes use strcpy!).

Let's instead teach parse_date, datestamp, etc to write to a
strbuf. The obvious downside is that we might need to
perform a heap allocation where we otherwise would not need
to. However, it turns out that the only two new allocations
required are:

  1. In test-date.c, where we don't care about efficiency.

  2. In determine_author_info, which is not performance
     critical (and where the use of a strbuf will help later
     refactoring).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>i18n: fix uncatchable comments for translators in date.c</title>
<updated>2014-04-17T18:03:28Z</updated>
<author>
<name>Jiang Xin</name>
<email>worldhello.net@gmail.com</email>
</author>
<published>2014-04-17T05:37:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fcaed04df693685dfece4a48cc8780c9a5adde0b'/>
<id>urn:sha1:fcaed04df693685dfece4a48cc8780c9a5adde0b</id>
<content type='text'>
Comment for l10n translators can not be extracted by xgettext if it
is not right above the l10n tag.  Moving the comment right before
the l10n tag will fix this issue.

Reported-by: Brian Gesiak &lt;modocache@gmail.com&gt;
Signed-off-by: Jiang Xin &lt;worldhello.net@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/commit-dates-parsing-fix'</title>
<updated>2014-03-14T21:25:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-14T21:25:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3c83b080e4dce42d0f48d28b03691ae1ac0dcde3'/>
<id>urn:sha1:3c83b080e4dce42d0f48d28b03691ae1ac0dcde3</id>
<content type='text'>
Tighten codepaths that parse timestamps in commit objects.

* jk/commit-dates-parsing-fix:
  show_ident_date: fix tz range check
  log: do not segfault on gmtime errors
  log: handle integer overflow in timestamps
  date: check date overflow against time_t
  fsck: report integer overflow in author timestamps
  t4212: test bogus timestamps with git-log
</content>
</entry>
<entry>
<title>log: do not segfault on gmtime errors</title>
<updated>2014-02-24T18:12:58Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-02-24T07:49:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2b15846dbfb31df10a69a4d56ae944a01563bc07'/>
<id>urn:sha1:2b15846dbfb31df10a69a4d56ae944a01563bc07</id>
<content type='text'>
Many code paths assume that show_date and show_ident_date
cannot return NULL. For the most part, we handle missing or
corrupt timestamps by showing the epoch time t=0.

However, we might still return NULL if gmtime rejects the
time_t we feed it, resulting in a segfault. Let's catch this
case and just format t=0.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>date: check date overflow against time_t</title>
<updated>2014-02-24T18:12:58Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-02-24T07:39:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7ca36d9398a85e7974d04f8fbd2c6adb088290e1'/>
<id>urn:sha1:7ca36d9398a85e7974d04f8fbd2c6adb088290e1</id>
<content type='text'>
When we check whether a timestamp has overflowed, we check
only against ULONG_MAX, meaning that strtoul has overflowed.
However, we also feed these timestamps to system functions
like gmtime, which expect a time_t. On many systems, time_t
is actually smaller than "unsigned long" (e.g., because it
is signed), and we would overflow when using these
functions.  We don't know the actual size or signedness of
time_t, but we can easily check for truncation with a simple
assignment.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
