Subject: Re: [PATCH v2 09/10] pretty: implement 'summary' format

From: Denton Liu <[email-masked]>
Date: Mon, 11 Nov 2019 15:47:10 -0800

Hi all,

On Sun, Nov 10, 2019 at 03:25:41PM +0900, Junio C Hamano wrote:
> René Scharfe <[email-masked]> writes:
> 
> > Hmm, that's quite a lot of code to add to the formatting code with its
> > repeated special-case checks.  Why not implement it as a built-in user
> > format, like making it an alias for something like this?
> >
> >    git log --format='%C(auto)%h ("%s", %as)'
> >
> > We don't have %as, yet, but making --date=short available as a
> > placeholder would be a good idea anyway (patch below).
> 
> Yes!  Implementing the 'summary' internally as merely an alias to a
> canned user format does sound like the right approach.

We don't have any canned user formats currently, do we? I'm trying to
figure out where to insert the code to do this.

Is the idea to just insert a row in the builtin_formats[] table in
setup_commit_formats() with the `user_format` field populated?

> 
> Further, instead of inventing %as, I think you could just use %ad
> there, and when 'summary' uses that canned user format, flip the
> default date format to short.
> 
> That way, "git show -s --pretty=summary --date=iso" would be
> available to those who like the format.

If we do implement it as a canned format, then we lose support for
displaying `--no-abbrev`, `--walk-reflogs`, `--decorate`. Would we be
okay with this?

Thanks,

Denton

> Thanks.