git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix '--relative-date'

From
Jeff King <peff@peff.net>
Date
Oct 3, 2009, 10:06 UTC
Message-ID
<20091003100615.GC17873@coredump.intra.peff.net>
In-Reply-To
<1254543618-3772-1-git-send-email-j416@1616.se>
On Sat, Oct 03, 2009 at 01:20:18PM +0900, Johan Sageryd wrote:
> This fixes '--relative-date' so that it does not give '0 year, 12
> months', for the interval 360 <= diff < 365.

Thanks. I think this was a regression introduced recently when we fixed the rounding on how years are printed (it used to just say "1 year" because we were close, but now we always round down, so our boundary for "1 year" must match exactly).

I've picked up your patch in my tree with the following test squashed in:

diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index a4d8fa8..75b02af 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -24,6 +24,7 @@ check_show 13000000 '5 months ago'
 check_show 37500000 '1 year, 2 months ago'
 check_show 55188000 '1 year, 9 months ago'
 check_show 630000000 '20 years ago'
+check_show 31449600 '12 months ago'
 
 check_parse() {
 	echo "$1 -> $2" >expect

-Peff
Previous: Johan SagerydNext: Johan Sageryd
Message 2 of 3 in “Fix '--relative-date'”
  1. Fix '--relative-date'Johan Sageryd, Oct 3, 2009
  2. Jeff KingOct 3, 2009
  3. Johan SagerydOct 3, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.