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

Re: Add configuration options for some commonly used command-line options

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Mar 19, 2017, 10:15 UTC
Message-ID
<vpqa88hlghm.fsf@anie.imag.fr>
In-Reply-To
<CACsJy8Du+WWWkx3wqRJYA=cyTdro=OOD7GWaFi29=h1_9yC+LQ@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 26 quoted lines
> On Thu, Feb 19, 2015 at 5:32 PM, Matthieu Moy
> <Matthieu.Moy@grenoble-inp.fr> wrote:
>> +### Add configuration options for some commonly used command-line options
>> +
>> +This includes:
>> +
>> +* git am -3
>> +
>> +* git am -c
>> +
>> +Some people always run the command with these options, and would
>> +prefer to be able to activate them by default in ~/.gitconfig.
>
> I was reading the .md file to add a new microproject and found this.
> Instead of adding new config case by case, should we do something more
> generic?
>
> We could have a new group defaultOptions.<command> (or
> <command>.options) which contains <option-name> = <value> where option
> names are the long name in parse-options? Then we don't have to
> manually add more config options any more (mostly, I'm aware of stuff
> like diff options that do not use parse-options).
>
> If we want to stop the users from shooting themselves in the foot, we
> could extend parse-options to allow/disallow certain options being
> used this way. Hmm?

I think the main problem is indeed "stop the users from shooting themselves in the foot". Many command-line options change the behavior completely so allowing users to enable them by default means allowing the users to change Git in such a way that scripts calling it are broken.

This also doesn't help when troublshouting an issue as these options are typically something set once and for all and which you forget about. This typically leads to discussion in Q&A forums like:

A: Can you run "git foo"?
B: Here's the result: ...
A: I don't understand, I can't reproduce here.
just because B has a CLI option enabled by default.

This is the same reasoning that leads Git to forbid aliasing an existing command to something else.

OTOH, we already have almost "enable such or such option by default" with aliases. People who always run "git am" with "-3" can write

[alias]
        a3 = am -3
and just run "git a3".
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Duy NguyenNext: brian m. carlson
Message 2 of 19 in “Add configuration options for some commonly used command-line options (Was: [RFH] GSoC 2015 application)”
  1. Duy NguyenMar 19, 2017
  2. Matthieu MoyMar 19, 2017
  3. brian m. carlsonMar 19, 2017
  4. Ævar Arnfjörð BjarmasonMar 19, 2017
  5. Duy NguyenMar 20, 2017
  6. Brandon WilliamsMar 20, 2017
  7. Jeff KingMar 20, 2017
  8. Brandon McCaigMar 31, 2017
  9. Junio C HamanoMar 20, 2017
  10. Jeff KingMar 20, 2017
  11. Ævar Arnfjörð BjarmasonMar 20, 2017
  12. parse-options: add facility to make options configurableÆvar Arnfjörð Bjarmason, Mar 24, 2017
  13. Ævar Arnfjörð BjarmasonMar 25, 2017
  14. Jeff KingMar 25, 2017
  15. Ævar Arnfjörð BjarmasonMar 25, 2017
  16. Jeff KingMar 28, 2017
  17. WIP configurable options facilityÆvar Arnfjörð Bjarmason, Mar 28, 2017
  18. brian m. carlsonMar 25, 2017
  19. Duy NguyenMar 20, 2017

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.