summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b4ae5e2)
raw | patch | inline | side by side (parent: b4ae5e2)
author | Johan Sageryd <j416@1616.se> | |
Sat, 3 Oct 2009 04:20:18 +0000 (13:20 +0900) | ||
committer | Jeff King <peff@peff.net> | |
Sat, 3 Oct 2009 10:04:38 +0000 (06:04 -0400) |
This fixes '--relative-date' so that it does not give '0
year, 12 months', for the interval 360 <= diff < 365.
Signed-off-by: Johan Sageryd <j416@1616.se>
Signed-off-by: Jeff King <peff@peff.net>
year, 12 months', for the interval 360 <= diff < 365.
Signed-off-by: Johan Sageryd <j416@1616.se>
Signed-off-by: Jeff King <peff@peff.net>
date.c | patch | blob | history | |
t/t0006-date.sh | patch | blob | history |
index e9ee4aa7484c531fab8e6d24fbdabdc640378e28..5d05ef61cfb140f004702a5ed614afa755c50670 100644 (file)
--- a/date.c
+++ b/date.c
return timebuf;
}
/* Say months for the past 12 months or so */
- if (diff < 360) {
+ if (diff < 365) {
snprintf(timebuf, timebuf_size, "%lu months ago", (diff + 15) / 30);
return timebuf;
}
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index a4d8fa8fa1c8b3c16aeeed49a3f4c52971f92518..75b02af86d4d613fac91b3cec28044e3b7f6274e 100755 (executable)
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
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