From: Theodore Ts'o <tytso@mit.edu>
To: Jeff King <peff@peff.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] pretty: add format specifiers: %gr, %gt, %gI, gi
Date: Mon, 11 Jul 2016 12:43:17 -0400 [thread overview]
Message-ID: <20160711164317.GB3890@thunk.org> (raw)
In-Reply-To: <20160711050201.GA18031@sigill.intra.peff.net>
On Mon, Jul 11, 2016 at 01:02:02AM -0400, Jeff King wrote:
> Yeah, I'd have hoped for %gd, as well. One thing I think we should move
> towards in the long run is giving more readable names to our
> placeholders for git-log, the way for-each-ref and cat-file do (but
> keeping the existing ones for compatibility and as a shorthand).
>
> So ideally the answer in the long run is:
>
> %(reflog-ref)@{%(reflog-index)}
>
> or possibly:
>
> %(reflog:index)
>
> for the whole thing. Or something like that. I haven't thought that hard
> about the exact syntax.
Yes, FWIW, I agree that long term, using % followed by one or two
characters is just a mess, and using some kind of human-readable
format is going to make a lot of sense. I can imagine a few places
where I might still want to type --format=%at in some kind of ad-hoc
shell command, but in most places, if you're using a complex --format
specifier, it's going either in a shell script or in a .gitconfig
file, where being verbose is probably more of an advantage than a
disadvantage.
> 1. It's half-implemented. Why can we do format X, but not format Y
> (for that matter, why can you do %ct, but there is no --date format
> that matches it?). That sort of non-orthogonality ends up
> frustrating for users and makes git look creaky and poorly thought
> out.
Git *is* creaky and not thought-out in advance; that's just the nature
of how most successful open source projects grow; might as well be
proud of it. :-) As Greg K-H has said: "We believe in evolution, and
not intelligent design." :-)
> > ... although I doubt whether git would ever want to do the equivalent of:
> >
> > gcloud compute images list --format='table[box,title=Images](name:sort=1,family)'
> >
> > which will print something like this:
>
> That's neat, though I think I'd really prefer just making it easy to get
> the data out of git in a structured way, and then applying some cool
> json-formatting script to it. Surely "turn this json into a table" is a
> thing that could be solved once for everybody (I don't work with it
> enough to know, but maybe "jq" can do that already).
Oh, agreed. I used that as over-the-top example of something we
probably wouldn't want to put in the git core. jq can't, but I'm sure
there must be some JSON tool out there which can.
> But let's get back to reality for a moment. Here are some patches that
> address the issues you brought up above.
>
> [1/5]: doc/rev-list-options: clarify "commit@{Nth}" for "-g" option
> [2/5]: doc/rev-list-options: explain "-g" output formats
> [3/5]: doc/pretty-formats: describe index/time formats for %gd
> [4/5]: date: document and test "raw-local" mode
> [5/5]: date: add "unix" format
>
> The next step is either:
>
> - add specific reflog-time-formats, as your patch does
>
> - add a generic reflog-date placeholder, so you can do:
>
> git log --date=unix --format='%gT'
>
> or whatever. That still doesn't give you multiple date types in a
> single invocation, though. It's probably not much code to do so, but
> designing the syntax and supporting existing placeholders would be
> some work.
>
> I'm on the fence, so I'll let you decide how you want to proceed. I can
> live with "%gr" and "%gt", as they are at least symmetric with their
> author/committer counterparts.
I'm on the fence myself. I can live with either, since either way the
long message command line will be going in .gitconfig. I have a
slight preference for %gr and %gt, as %gT isn't orthogonal with
%ad/%cd, but I could be easily pursuaded otherwise.
Does anyone else have a strong opinion?
- Ted
next prev parent reply other threads:[~2016-07-11 16:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-10 5:54 [PATCH] pretty: add format specifiers: %gr, %gt, %gI, gi Theodore Ts'o
2016-07-10 6:16 ` Jeff King
2016-07-10 14:26 ` Theodore Ts'o
2016-07-10 16:05 ` Duy Nguyen
2016-07-10 23:28 ` Theodore Ts'o
2016-07-11 5:02 ` Jeff King
2016-07-11 5:03 ` [PATCH 1/5] doc/rev-list-options: clarify "commit@{Nth}" for "-g" option Jeff King
2016-07-11 5:04 ` [PATCH 2/5] doc/rev-list-options: explain "-g" output formats Jeff King
2016-07-11 5:05 ` [PATCH 3/5] doc/pretty-formats: describe index/time formats for %gd Jeff King
2016-07-11 16:48 ` Theodore Ts'o
2016-07-12 0:08 ` Jeff King
2016-07-12 2:01 ` Junio C Hamano
2016-07-11 5:06 ` [PATCH 4/5] date: document and test "raw-local" mode Jeff King
2016-07-11 16:50 ` Theodore Ts'o
2016-07-12 0:16 ` Jeff King
2016-07-11 5:07 ` [PATCH 5/5] date: add "unix" format Jeff King
2016-07-11 16:43 ` Theodore Ts'o [this message]
2016-07-11 19:07 ` [PATCH] pretty: add format specifiers: %gr, %gt, %gI, gi Junio C Hamano
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=20160711164317.GB3890@thunk.org \
--to=tytso@mit.edu \
--cc=git@vger.kernel.org \
--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.
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).