All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* "Medium" log format: change proposal for author != committer
@ 2015-09-15 21:52 Robin H. Johnson
  2015-09-16  1:52 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Robin H. Johnson @ 2015-09-15 21:52 UTC (permalink / raw
  To: Git Mailing List

Hi,

I want to propose a change to the 'medium' log output format, to improve
readability.

Specifically, if the author is NOT the same as the committer, then
display both in the header. Otherwise continue to display only the
author.

This would aid quick review of changes in git-log & git-show output.

-- 
Robin Hugh Johnson
Gentoo Linux: Developer, Infrastructure Lead
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Medium" log format: change proposal for author != committer
  2015-09-15 21:52 "Medium" log format: change proposal for author != committer Robin H. Johnson
@ 2015-09-16  1:52 ` Junio C Hamano
  2015-09-16  6:54   ` Jacob Keller
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2015-09-16  1:52 UTC (permalink / raw
  To: Robin H. Johnson; +Cc: Git Mailing List

"Robin H. Johnson" <robbat2@gentoo.org> writes:

> Specifically, if the author is NOT the same as the committer, then
> display both in the header. Otherwise continue to display only the
> author.

I too found myself wanting to see both of the names sometimes, and
the "fuller" format was added explicitly for that purpose.

Even though I agree "show only one, and both only when they are
different" is a reasonable and possibly useful format, it is out of
question to change what "--pretty=medium" does.  It has been with us
forever and people and their scripts do rely on it.

It would be good if we can say

    $ git log --pretty=robinsformat

but with a better name to show such an output.


Having said that, I'm moderately negative about adding it as yet
another hard-coded format.  We simply have too many, and we do not
need one more.  What we need instead is a flexible framework to let
users get what they want.

I think what needs to happen is:

 * 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..."

   and run "git log --pretty=robin", it would behave as if you said
   "git log --pretty="format:commit %H%nAuthor: %an <%ae>%n...".

 * (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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Medium" log format: change proposal for author != committer
  2015-09-16  1:52 ` Junio C Hamano
@ 2015-09-16  6:54   ` Jacob Keller
  2015-09-16 22:25     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jacob Keller @ 2015-09-16  6:54 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Robin H. Johnson, Git Mailing List

On Tue, Sep 15, 2015 at 6:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>  * 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.

>  * (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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Medium" log format: change proposal for author != committer
  2015-09-16  6:54   ` Jacob Keller
@ 2015-09-16 22:25     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2015-09-16 22:25 UTC (permalink / raw
  To: Jacob Keller; +Cc: Robin H. Johnson, Git Mailing List

Jacob Keller <jacob.keller@gmail.com> writes:

> On Tue, Sep 15, 2015 at 6:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>
>>  * 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":

Yup.  But before the first bullet item is done, it cannot be used to
replace the built-in hardcoded formats with a built-in set of default
configurations.

>>  * (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..

One that we know we cannot is the nice conditional one Robin wants.
I do think it is a reasonable thing to have.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-16 22:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 21:52 "Medium" log format: change proposal for author != committer Robin H. Johnson
2015-09-16  1:52 ` Junio C Hamano
2015-09-16  6:54   ` Jacob Keller
2015-09-16 22:25     ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.