git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: eletuchy@gmail.com
To: gitster@pobox.com, peff@peff.net
Cc: git@vger.kernel.org, eletuchy@facebook.com,
	Eugene Letuchy <eugene@facebook.com>
Subject: [PATCH 2/2] --date=relative falls back to "short" format for commits older than a year
Date: Fri, 20 Feb 2009 13:23:54 -0800	[thread overview]
Message-ID: <1235165034-20299-1-git-send-email-eletuchy@gmail.com> (raw)

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

             reply	other threads:[~2009-02-20 21:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 21:23 eletuchy [this message]
2009-02-20 22:15 ` [PATCH 2/2] --date=relative falls back to "short" format for commits older than a year 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1235165034-20299-1-git-send-email-eletuchy@gmail.com \
    --to=eletuchy@gmail.com \
    --cc=eletuchy@facebook.com \
    --cc=eugene@facebook.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).