git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] --date=relative falls back to "short" format for commits older than a year
@ 2009-02-20 21:23 eletuchy
  2009-02-20 22:15 ` Linus Torvalds
  2009-02-22 23:06 ` Jeff King
  0 siblings, 2 replies; 15+ messages in thread
From: eletuchy @ 2009-02-20 21:23 UTC (permalink / raw)
  To: gitster, peff; +Cc: git, eletuchy, Eugene Letuchy

From: Eugene Letuchy <eugene@facebook.com>

In the context of sizing the git blame time column, it doesn't make a
lot of sense to see "12 months ago" next to an exact timestamp +
timezone for something 13 months ago. This commit makes commits older
than 12 months display the date only, not the time.

Signed-off-by: Eugene Letuchy <eugene@facebook.com>
---
 builtin-blame.c |    5 ++---
 date.c          |    4 +++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/builtin-blame.c b/builtin-blame.c
index aa5c66c..48cedfd 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2286,9 +2286,8 @@ parse_done:
 		blame_date_width = sizeof("2006-10-19");
 		break;
 	case DATE_RELATIVE:
-		/* unfortunately "normal" is the fallback for "relative" */
-		/* blame_date_width = sizeof("14 minutes ago"); */
-		/* break; */
+		blame_date_width = sizeof("14 minutes ago");
+		break;
 	case DATE_LOCAL:
 	case DATE_NORMAL:
 		blame_date_width = sizeof("Thu Oct 19 16:00:04 2006 -0700");
diff --git a/date.c b/date.c
index 950b88f..edb2078 100644
--- a/date.c
+++ b/date.c
@@ -128,7 +128,9 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
 			snprintf(timebuf, sizeof(timebuf), "%lu months ago", (diff + 15) / 30);
 			return timebuf;
 		}
-		/* Else fall back on absolute format.. */
+
+		/* Else fall back to the short format */
+		mode = DATE_SHORT;
 	}
 
 	if (mode == DATE_LOCAL)
-- 
1.6.2.rc1.14.g07c3.dirty

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-02-24  7:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-20 21:23 [PATCH 2/2] --date=relative falls back to "short" format for commits older than a year eletuchy
2009-02-20 22:15 ` Linus Torvalds
2009-02-20 22:47   ` Eugene Letuchy
2009-02-21  5:48   ` Junio C Hamano
2009-02-22 23:06 ` Jeff King
2009-02-23  1:44   ` Junio C Hamano
2009-02-23  3:16     ` Jeff King
2009-02-23  8:09       ` Marius Storm-Olsen
2009-02-24  5:04         ` Jeff King
2009-02-24  6:35           ` Marius Storm-Olsen
2009-02-24  6:36             ` Jeff King
2009-02-23 16:33       ` Junio C Hamano
2009-02-24  5:42         ` Jeff King
2009-02-24  6:59           ` Junio C Hamano
2009-02-24  7:07             ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).