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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html