threads / discuss / 58363

Considering add log.format and show.format configure option

Subject: Considering add log.format and show.format configure option

## tl;dr

3 messages between Aug 26, 2022 and Aug 26, 2022.

replies: 2people: 3as markdown or json

Zang· Aug 26, 2022, 07:12 UTC · lore
Hi forks,
People including me are asking feature to use different format for log and show:

https://stackoverflow.com/questions/20579889/different-pretty-formats-for-git-log-and-git-show https://stackoverflow.com/questions/37898232/make-different-pretty-settings-for-git-log-and-git-show

Can we consider add such option to git-config
[format]
    mylogformat = <...>
    myshowformat = <...>
[log]
    format = mylogformat
[show]
    format = myshowformat
Which should work same as

git log --format=mylogformat git show --format=myshowformat

Jeff King· Aug 26, 2022, 07:58 UTC · re: Zang · lore

Re: Considering add log.format and show.format configure option

On Fri, Aug 26, 2022 at 03:12:34PM +0800, Zang wrote:
Show 14 quoted lines
> Can we consider add such option to git-config
> 
> [format]
>     mylogformat = <...>
>     myshowformat = <...>
> [log]
>     format = mylogformat
> [show]
>     format = myshowformat
> 
> Which should work same as
> 
> git log --format=mylogformat
> git show --format=myshowformat

I don't think there is any reason not to add something like that. As you note, we already allow overriding the default for all of the log-family commands. So doing it for individual ones is not a stretch.

(I'm not sure if you know, the first half of your suggestion is already available as pretty.*, so this would just be adding log.format, etc, to override format.pretty. Possibly your "format' is just a typo of "pretty" there).

-Peff
Junio C Hamano· Aug 26, 2022, 16:42 UTC · re: Zang · lore

Re: Considering add log.format and show.format configure option

Zang <zealot0630@gmail.com> writes:
Show 5 quoted lines
> Hi forks,
>
> People including me are asking feature to use different format for log and show:
>
> https://stackoverflow.com/q...
We do not pay attention to SO, and it is good you came here.
> [log]
>     format = mylogformat
> [show]
>     format = myshowformat

I think something along this line was raised as a possible enhancement on the list earlier. If we were to do so, we should not limit the enhancement only to "log/show" but to all the commands in the "log" family, and similarly, not only to "format", but to many common options.

Patches welcome.
Thanks.

← back to recent threads