<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/date.c, branch v2.23.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.23.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.23.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-02-20T20:31:56Z</updated>
<entry>
<title>completion: add more parameter value completion</title>
<updated>2019-02-20T20:31:56Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-02-16T11:24:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5a59a2301f6ec9bcf1b101edb9ca33beb465842f'/>
<id>urn:sha1:5a59a2301f6ec9bcf1b101edb9ca33beb465842f</id>
<content type='text'>
This adds value completion for a couple more paramters. To make it
easier to maintain these hard coded lists, add a comment at the original
list/code to remind people to update git-completion.bash too.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'lt/date-human'</title>
<updated>2019-02-07T06:05:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-02-07T06:05:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ecbe1beb8e41664ac00581234a449c4487600e1d'/>
<id>urn:sha1:ecbe1beb8e41664ac00581234a449c4487600e1d</id>
<content type='text'>
A new date format "--date=human" that morphs its output depending
on how far the time is from the current time has been introduced.
"--date=auto" can be used to use this new format when the output is
going to the pager or to the terminal and otherwise the default
format.

* lt/date-human:
  Add `human` date format tests.
  Add `human` format to test-tool
  Add 'human' date format documentation
  Replace the proposed 'auto' mode with 'auto:'
  Add 'human' date format
</content>
</entry>
<entry>
<title>Add `human` format to test-tool</title>
<updated>2019-01-29T17:40:08Z</updated>
<author>
<name>Stephen P. Smith</name>
<email>ischis2@cox.net</email>
</author>
<published>2019-01-29T03:50:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b841d4ff438576fe0c3f69b7d48ba46a442f162b'/>
<id>urn:sha1:b841d4ff438576fe0c3f69b7d48ba46a442f162b</id>
<content type='text'>
Add the human format support to the test tool so that
GIT_TEST_DATE_NOW can be used to specify the current time.

The get_time() helper function was created and and checks the
GIT_TEST_DATE_NOW environment variable.  If GIT_TEST_DATE_NOW is set,
then that date is used instead of the date returned by by
gettimeofday().

All calls to gettimeofday() were replaced by calls to get_time().

Renamed occurances of TEST_DATE_NOW to GIT_TEST_DATE_NOW since the
variable is now used in the get binary and not just in the test-tool.

Signed-off-by: Stephen P. Smith &lt;ischis2@cox.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>show_date_relative(): drop unused "tz" parameter</title>
<updated>2019-01-24T20:35:44Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-01-24T13:12:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3d42034a18297bc014e2132121c4854f5a07fe4c'/>
<id>urn:sha1:3d42034a18297bc014e2132121c4854f5a07fe4c</id>
<content type='text'>
The timestamp we receive is in epoch time, so there's no need for a
timezone parameter to interpret it. The matching show_date() uses "tz"
to show dates in author local time, but relative dates show only the
absolute time difference. The author's location is irrelevant, barring
relativistic effects from using Git close to the speed of light.

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>Replace the proposed 'auto' mode with 'auto:'</title>
<updated>2019-01-22T22:16:17Z</updated>
<author>
<name>Stephen P. Smith</name>
<email>ischis2@cox.net</email>
</author>
<published>2019-01-21T05:31:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2fd7c22992d37469db957e9a4d3884a6c0a4d182'/>
<id>urn:sha1:2fd7c22992d37469db957e9a4d3884a6c0a4d182</id>
<content type='text'>
In addition to adding the 'human' format, the patch added the auto
keyword which could be used in the config file as an alternate way to
specify the human format.  Removing 'auto' cleans up the 'human'
format interface.

Added the ability to specify mode 'foo' if the pager is being used by
using auto:foo syntax.  Therefore, 'auto:human' date mode defaults to
human if we're using the pager.  So you can do

	git config --add log.date auto:human

and your "git log" commands will show the human-legible format unless
you're scripting things.

Signed-off-by: Stephen P. Smith &lt;ischis2@cox.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Add 'human' date format</title>
<updated>2019-01-18T18:31:23Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2019-01-18T06:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=acdd37769de8b0fe37a74bfc0475b63bdc55e9dc'/>
<id>urn:sha1:acdd37769de8b0fe37a74bfc0475b63bdc55e9dc</id>
<content type='text'>
This adds --date=human, which skips the timezone if it matches the
current time-zone, and doesn't print the whole date if that matches (ie
skip printing year for dates that are "this year", but also skip the
whole date itself if it's in the last few days and we can just say what
weekday it was).

For really recent dates (same day), use the relative date stamp, while
for old dates (year doesn't match), don't bother with time and timezone.

Also add 'auto' date mode, which defaults to human if we're using the
pager.  So you can do

	git config --add log.date auto

and your "git log" commands will show the human-legible format unless
you're scripting things.

Note that this time format still shows the timezone for recent enough
events (but not so recent that they show up as relative dates).  You can
combine it with the "-local" suffix to never show timezones for an even
more simplified view.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Stephen P. Smith &lt;ischis2@cox.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>approxidate: fix NULL dereference in date_time()</title>
<updated>2018-11-07T02:04:06Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-07T01:12:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aa097b88e91bd748c4508b042e618e8292e15ad5'/>
<id>urn:sha1:aa097b88e91bd748c4508b042e618e8292e15ad5</id>
<content type='text'>
When we see a time like "noon", we pass "12" to our date_time() helper,
which sets the hour to 12pm. If the current time is before noon, then we
wrap around to yesterday using date_yesterday(). But unlike the normal
calls to date_yesterday() from approxidate_alpha(), we pass a NULL "num"
parameter. Since c27cc94fad (approxidate: handle pending number for
"specials", 2018-11-02), that causes a segfault.

One way to fix this is by checking for NULL. But arguably date_time() is
abusing our helper by passing NULL in the first place (and this is the
only case where one of these "special" parsers is used this way). So
instead, let's have it just do the 1-day subtraction itself. It's still
just a one-liner due to our update_tm() helper.

Note that the test added here is a little funny, as we say "10am noon",
which makes the "10am" seem pointless.  But this bug can only be
triggered when it the currently-parsed hour is before the special time.
The latest special time is "tea" at 1700, but t0006 uses a hard-coded
TEST_DATE_NOW of 1900. We could reset TEST_DATE_NOW, but that may lead
to confusion in other tests. Just saying "10am noon" makes this test
self-contained.

Reported-by: Carlo Arenas &lt;carenas@gmail.com&gt;
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>approxidate: handle pending number for "specials"</title>
<updated>2018-11-02T11:49:53Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-02T05:23:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c27cc94fad36ba46fea4a031d6df9d45b931f421'/>
<id>urn:sha1:c27cc94fad36ba46fea4a031d6df9d45b931f421</id>
<content type='text'>
The approxidate parser has a table of special keywords like
"yesterday", "noon", "pm", etc. Some of these, like "pm", do
the right thing if we've recently seen a number: "3pm" is
what you'd think.

However, most of them do not look at or modify the
pending-number flag at all, which means a number may "jump"
across a significant keyword and be used unexpectedly. For
example, when parsing:

  January 5th noon pm

we'd connect the "5" to "pm", and ignore it as a
day-of-month. This is obviously a bit silly, as "noon"
already implies "pm". And other mis-parsed things are
generally as silly ("January 5th noon, years ago" would
connect the 5 to "years", but probably nobody would type
that).

However, the fix is simple: when we see a keyword like
"noon", we should flush the pending number (as we would if
we hit another number, or the end of the string). In a few
of the specials that actually modify the day, we can simply
throw away the number (saying "Jan 5 yesterday" should not
respect the number at all).

Note that we have to either move or forward-declare the
static pending_number() to make it accessible to these
functions; this patch moves it.

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>Replace all die("BUG: ...") calls by BUG() ones</title>
<updated>2018-05-06T10:06:13Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-05-02T09:38:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=033abf97fcbc247eabf915780181d947cfb66205'/>
<id>urn:sha1:033abf97fcbc247eabf915780181d947cfb66205</id>
<content type='text'>
In d8193743e08 (usage.c: add BUG() function, 2017-05-12), a new macro
was introduced to use for reporting bugs instead of die(). It was then
subsequently used to convert one single caller in 588a538ae55
(setup_git_env: convert die("BUG") to BUG(), 2017-05-12).

The cover letter of the patch series containing this patch
(cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not
terribly clear why only one call site was converted, or what the plan
is for other, similar calls to die() to report bugs.

Let's just convert all remaining ones in one fell swoop.

This trick was performed by this invocation:

	sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c)

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ab/strbuf-addftime-tzname-boolify'</title>
<updated>2017-07-07T01:14:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-07-07T01:14:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6ba649e4085bd7b8c80fd2080ca003bf450c9f53'/>
<id>urn:sha1:6ba649e4085bd7b8c80fd2080ca003bf450c9f53</id>
<content type='text'>
strbuf_addftime() is further getting tweaked.

* ab/strbuf-addftime-tzname-boolify:
  strbuf: change an always NULL/"" strbuf_addftime() param to bool
  strbuf.h comment: discuss strbuf_addftime() arguments in order
</content>
</entry>
</feed>
