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

[PATCH 2/2] --date=relative falls back to "short" format for commits older than a year

From
Eeletuchy@gmail.com <eletuchy@gmail.com>
Date
Feb 20, 2009, 21:23 UTC
Message-ID
<1235165034-20299-1-git-send-email-eletuchy@gmail.com>
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
Next: Linus Torvalds
Message 1 of 15 in “--date=relative falls back to "short" format for commits older than a year”
  1. 2/2 --date=relative falls back to "short" format for commits older than a yeareletuchy@gmail.com, Feb 20, 2009
  2. Linus TorvaldsFeb 20, 2009
  3. Eugene LetuchyFeb 20, 2009
  4. Junio C HamanoFeb 21, 2009
  5. Jeff KingFeb 22, 2009
  6. Junio C HamanoFeb 23, 2009
  7. Jeff KingFeb 23, 2009
  8. Marius Storm-OlsenFeb 23, 2009
  9. Jeff KingFeb 24, 2009
  10. Marius Storm-OlsenFeb 24, 2009
  11. Jeff KingFeb 24, 2009
  12. Junio C HamanoFeb 23, 2009
  13. Jeff KingFeb 24, 2009
  14. Junio C HamanoFeb 24, 2009
  15. Jeff KingFeb 24, 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.