Thread (1 message) 1 message, 1 author, 2021-09-17

Re: [QUESTION] How to add new configuration variable

From: Junio C Hamano <hidden>
Date: 2021-09-17 20:02:34

Đoàn Trần Công Danh  [off-list ref] writes:
On 2021-09-17 09:43:18-0400, Konstantin Ryabitsev [off-list ref] wrote:
quoted
On Fri, Sep 17, 2021 at 05:44:42PM +0700, Bagas Sanjaya wrote:
quoted
Supposed that I'm writing git-foobar script ("git-foobar.sh"), which takes
configuration variable "foobar.something" (string type).

How can I add that configuration variable so that it can be used by the
script?
You can just add it. :) Git doesn't complain when it finds configuration
parameters it doesn't know anything about, it just ignores them.

E.g. in your .gitconfig or individual repository .git/config:

    [foobar]
        something = yourvalue
Or just:

	git config [--global] foobar.something yourvalue
In addition to that, unless it is a script for your throw-away use
that we do not have to worry about, consider if the users of "git
foobar" needs to override a configured value with --no-something or
--something=anothervalue from the command line, and if so, make sure
these command line options are available to them.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help