diff options
author | Jeff King <peff@peff.net> | 2018-11-02 01:23:09 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-02 20:49:53 +0900 |
commit | c27cc94fad36ba46fea4a031d6df9d45b931f421 (patch) | |
tree | 3bebc46198a1579b1136470e081ff35f3ae95f2b /git-parse-remote.sh | |
parent | rev-list: handle flags for --indexed-objects (diff) | |
download | tgif-c27cc94fad36ba46fea4a031d6df9d45b931f421.tar.xz |
approxidate: handle pending number for "specials"
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-parse-remote.sh')
0 files changed, 0 insertions, 0 deletions