git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "Medium" log format: change proposal for author != committer

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 16, 2015, 01:52 UTC
Message-ID
<xmqq8u87t9jb.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<robbat2-20150915T214920-375711965Z@orbis-terrarum.net>
"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.
Previous: Robin H. JohnsonNext: Jacob Keller
Message 2 of 4 in “"Medium" log format: change proposal for author != committer”
  1. Robin H. JohnsonSep 15, 2015
  2. Junio C HamanoSep 16, 2015
  3. Jacob KellerSep 16, 2015
  4. Junio C HamanoSep 16, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.