Re: "Medium" log format: change proposal for author != committer
- From
Jacob Keller <jacob.keller@gmail.com>
- Date
- Sep 16, 2015, 06:54 UTC
- Message-ID
- <CA+P7+xqhJKGmxC=35bRvdKSj=nKRhfH9SqhR9ryrcBDknH-Y=w@mail.gmail.com>
- In-Reply-To
- <xmqq8u87t9jb.fsf@gitster.mtv.corp.google.com>
On Tue, Sep 15, 2015 at 6:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> > * Enhance the "--pretty=format:" thing so that the current set of > hardcoded --pretty=medium,short,... formats and your modified > "medium" can be expressed as a custom format string. > > * Introduce a configuration mechanism to allow users to define new > short-hand, e.g. if you have this in your $HOME/.gitconfig: > > [pretty "robin"] > format = "commit %H%nAuthor: %an <%ae>%n..." >
Afiak there is already support for this.. from "git help config":
pretty.<name> Alias for a --pretty= format string, as specified in git-log(1). Any aliases defined here can be used just as the built-in pretty formats could. For example, running git config pretty.changelog "format:* %H %s" would cause the invocation git log --pretty=changelog to be equivalent to running git log "--pretty=format:* %H %s". Note that an alias with the same name as a built-in format will be silently ignored.
> and run "git log --pretty=robin", it would behave as if you said > "git log --pretty="format:commit %H%nAuthor: %an <%ae>%n...". >
So this should already be supported... but to support "robinsformat" we'd need to be able to "show committer only if different from author"... Not sure how that would work.
Show 6 quoted lines
> * (optional) Replace the hardcoded implementations of pretty > formats with short-hand names like "medium", "short", etc. with a > built-in set of pretty.$name.format using the configuration > mechanism. But we need to make sure this does not hurt > performance for common cases. >
This part obviously hasn't been done, I don't know if any particular format is not expressable today by the pretty syntax or not..
But at least configuration does work. I use it as part of displaying the
Fixes: <sha1> ("name")used by the upstream kernel for marking bug fixes of known commits.
Thus the only real thing would be implementing a % modifier which allows showing commiter if it's not the same as author. (or vise versa) Ideally we could take work from the ref-filter library and the proposed "%if" stuff but I don't tihnk this was actually implemented yet, and I don't know if that would even work in the pretty modifiers.
Regards, Jake