git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [RFC PATCH v2] Add 'human' date format
Date: Wed, 11 Jul 2018 14:49:32 -0700	[thread overview]
Message-ID: <CA+55aFw2srtqU2B60wWo9h38pTTwT4zCDHZDwb+WMpMAbc0wOg@mail.gmail.com> (raw)
In-Reply-To: <87h8l5cvp3.fsf@evledraar.gmail.com>

On Wed, Jul 11, 2018 at 2:24 PM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
> I think that's true for the likes of linux.git & git.git, but a lot of
> users of git say work in some corporate setting entirely or mostly in
> the same timezone.
>
> In that case, knowing if some commit whose sole message was "fix"[1] was
> made at 3am or in the afternoon, even if it's really old, is really
> useful information, even years later.

Heh.

Maybe. But if  you care about that kind of information, would you
actually want to use the "human" date? Wouldn't you want to use the
strftime thing instead, which gets you whatever field you care about,
and gets it consistently regardless of how old the data is?

That said, I do acknowledge that the "human" format may be a bit
inflexible and ad-hoc. Of course some more generic way that allowed
arbitrary rules might be better for some uses.

I'll just explain the cases that made me zero in on what that last patch did:

 (a) I do like the "relative" date for recent stuff.

Quite often, I look at how recent the commits are, for example, and
then I really like seeing "2 hours ago" rather than a time with a
timezone (which is a lot harder for me to mentally parse)

This was the primary impetus for my original "auto" patch many years
ago, that was (rightly) not merged. It really boiled down to just
"default or relative, depending on how recent it was".

 (b) I noticed that I was distracted by dates that were *too* terse.

My first patch had _just_ the time when it was today and the same
timezone (but older than two hours, so the original relative logic
didn't trigger).

That initially sounded great to me, which is why it was that first time.

But after _using_ it for a while, I actually found that it didn't have
enough context for me (visually) to really trigger my date parsing at
all.

So "five hours ago" actually parsed better than just "9:48" to me. I
didn't think it would do that, but it did. Which was why I changed the
"relative" time to trigger every time if it was the exact same date
(and in the past) - just to avoid the really terse model.

 (c) when I played around with other commands than just "git log", I
also noticed that a consistent length mattered.,

Again, my first version was more along the lines of "if it's long ago,
just use the full format, exactly like the default date". It wasn't
*quite* that, because it would always skip the seconds, but it was
close.

And with "git log", that worked fine, because dates were fairly
uniformly increasing, so the date format would slowly get longer, and
that was fine.

But then when I played with "git blame -C --date=human", I noticed
that not only did the human date actually make sense there too, it
actually made it easier for me to read - and that in particular, the
"extra" info was just annoying.

So now I find that shortened "only show the date" format to be really
good _particularly_ for "git blame". You can see very clearly whether
it's something recent or something old.

Maybe my use of "git blame" is unusual, but I don't think so. I tend
to do "git blame -C" when I'm looking for a bug, and then seeing
something like this:

        ...
          Apr 16 2005       437)
          Apr 16 2005       438)
          Jan 14 2016       439)
          Apr 16 2005       440)
          Apr 16 2005       441)
          Apr 16 2005       442)
          Thu Jun 14 15:26  443)
          Thu Jun 14 15:26  444)
          Thu Jun 14 15:26  445)
          Thu Jun 14 15:26  446)
          Thu Jun 14 15:26  447)
          Thu Jun 14 15:26  448)
          Thu Jun 14 15:26  449)
          Thu Jun 14 15:26  450)
          Apr 16 2005       451)
          Jul 30 2012       452)
          Jul 30 2012       453)
          Feb 13 2012       454)
          Apr 16 2005       455)
          Apr 16 2005       456)
        ....

in that date field (yeah. that happens to be "kernel/fork.c" in the
current kernel - I just edited out all the other stuff than time and
line number) is actually very visually easy to see what parts are old,
and which ones are recent, because it changes the format pretty
clearly and unambiguously, without changing the size of that field
_dramatically_.

(Sure, the size changes, but it's not a radical difference, it's a
fairly small variation, and the variation only highlights the
different time range, without making it compltely unbalanced).

Anyway, enough excuses. I'l just trying to explain some of the things
that I noticed simply _while_ making some of the decisions I made.

Are they the "right" decisions? I don't know. But I've been running with that

        git config --add log.date auto

in my kernel repo since I posted the patches, and so far I'm still liking it.

                 Linus

  reply	other threads:[~2018-07-11 21:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-07 19:38 [RFC PATCH] Add 'human' date format Linus Torvalds
2018-07-07 19:58 ` Linus Torvalds
2018-07-07 20:12   ` Linus Torvalds
2018-07-07 22:02 ` [RFC PATCH v2] " Linus Torvalds
2018-07-11 20:34   ` Andrei Rybak
2018-07-11 20:38     ` Andrei Rybak
2018-07-11 20:54       ` Junio C Hamano
2018-07-11 20:49     ` Linus Torvalds
2018-07-11 21:23       ` Linus Torvalds
2018-07-11 21:24   ` Ævar Arnfjörð Bjarmason
2018-07-11 21:49     ` Linus Torvalds [this message]
2018-07-24 21:49   ` Junio C Hamano
2018-07-24 22:58     ` Linus Torvalds
2018-11-27  4:10   ` Stephen P. Smith

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CA+55aFw2srtqU2B60wWo9h38pTTwT4zCDHZDwb+WMpMAbc0wOg@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).