git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Robert Karszniewicz <avoidr@posteo.de>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH] log: add log.showStat configuration variable
Date: Mon, 12 Oct 2020 08:50:35 -0400	[thread overview]
Message-ID: <1f53a7d8-6aa5-e1c7-ecb9-b99a37500034@gmail.com> (raw)
In-Reply-To: <20201011095916.GA14933@HP>

On 10/11/2020 5:59 AM, Robert Karszniewicz wrote:
> On Thu, Oct 08, 2020 at 02:12:50PM -0400, Derrick Stolee wrote:
>> On 10/8/2020 12:20 PM, Robert Karszniewicz wrote:
>>> Changes default behaviour of `git log` and `git show` when no
>>> command-line options are given. Doesn't affect behaviour otherwise (same
>>> behaviour as with stash.showStat).
>>> ---
>>> I've wanted to have `show` and `log` show --stat by default, and I
>>> couldn't find any better solution for it. And I've discovered that there
>>> is stash.showStat, which is exactly what I want. So I wanted to bring
>>> stash.showStat to `show` and `log`.
>>
>> I'm wondering: why should this be a config setting instead of just
>> a configure alias?
> 
> I answered this in the reply to Junio C Hamano.
> 
> Actually, the first thing I tried, was make an alias named after the git
> command, like so:
> 
>   git config --global alias.show "show --stat"
>   git config --global alias.log "log --stat"
> 
> But that didn't work. Why, actually? We're used to it from our POSIX
> shells, and other places I can't think of, but it feels familiar.
> Perhaps this would be a good way to enable changing default behaviour of
> each git command without having to change anything about config
> handling? Would this be difficult to do?

You can't replace a builtin with an alias, because that creates a
recursive loop. Note that I changed the name to "slog" for my example.

If you are going to customize it, then you need to remember your new
name. But this is something you can do right now without needing to
patch Git.

>> If this is something we want to do as a config instead of alias,
>> I'm wondering if it is worth expanding the scope and thinking about
>> these other arguments (like --graph, --oneline, etc.) and how they
>> could be incorporated into a coherent config system.
>>
>> I worry that this initial step leads us down a road of slowly adding
>> one-off config settings for each option when:
> 
> I worried about that, too. But I think the initial step was already in
> 2015, when stash.showStat and stash.showPatch were added. No flood of
> options happened since then? I was actually surprised about it, too,
> that it took so long until someone wanted to have showStat for show and
> log, too.

I'm not sure these examples will help your case.

Does 'stash' have more things that would be beneficial to show
every time? If no, then 'stash' is much more specialized than
'show' and 'log' which have many more options. If yes, then this
is exactly what we want to avoid happening: an incomplete set of
config options that are tailored to a small subset of options.

While my stance is still "an alias should suffice," perhaps it is
worth investigating the "status.*" config options, which include
this kind of behavior:

* status.aheadBehind can disable some output normally there by
  default. (This was created for performance implications.)

* status.showStash enables --show-stash

* status.showUntrackedFiles enables --untracked-files

* status.submoduleSummary interacts with --ignore-submodules

Thanks,
-Stolee

  reply	other threads:[~2020-10-12 12:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 16:20 [RFC PATCH] log: add log.showStat configuration variable Robert Karszniewicz
2020-10-08 17:58 ` Junio C Hamano
2020-10-10 14:02   ` Robert Karszniewicz
2020-10-08 18:12 ` Derrick Stolee
2020-10-11  9:59   ` Robert Karszniewicz
2020-10-12 12:50     ` Derrick Stolee [this message]
2020-10-12 16:14       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f53a7d8-6aa5-e1c7-ecb9-b99a37500034@gmail.com \
    --to=stolee@gmail.com \
    --cc=avoidr@posteo.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).