* [QUESTION] How to add new configuration variable
@ 2021-09-17 10:44 Bagas Sanjaya
2021-09-17 13:43 ` Konstantin Ryabitsev
2021-09-17 16:21 ` Carlo Arenas
0 siblings, 2 replies; 5+ messages in thread
From: Bagas Sanjaya @ 2021-09-17 10:44 UTC (permalink / raw)
To: Git Users
Hi,
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?
--
An old man doll... just what I always wanted! - Clara
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [QUESTION] How to add new configuration variable
2021-09-17 10:44 [QUESTION] How to add new configuration variable Bagas Sanjaya
@ 2021-09-17 13:43 ` Konstantin Ryabitsev
2021-09-17 15:20 ` Đoàn Trần Công Danh
2021-09-17 16:21 ` Carlo Arenas
1 sibling, 1 reply; 5+ messages in thread
From: Konstantin Ryabitsev @ 2021-09-17 13:43 UTC (permalink / raw)
To: Bagas Sanjaya; +Cc: Git Users
On Fri, Sep 17, 2021 at 05:44:42PM +0700, Bagas Sanjaya wrote:
> 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
-K
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [QUESTION] How to add new configuration variable
2021-09-17 13:43 ` Konstantin Ryabitsev
@ 2021-09-17 15:20 ` Đoàn Trần Công Danh
2021-09-17 20:02 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Đoàn Trần Công Danh @ 2021-09-17 15:20 UTC (permalink / raw)
To: Konstantin Ryabitsev; +Cc: Bagas Sanjaya, Git Users
On 2021-09-17 09:43:18-0400, Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> On Fri, Sep 17, 2021 at 05:44:42PM +0700, Bagas Sanjaya wrote:
> > 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
--
Danh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [QUESTION] How to add new configuration variable
2021-09-17 10:44 [QUESTION] How to add new configuration variable Bagas Sanjaya
2021-09-17 13:43 ` Konstantin Ryabitsev
@ 2021-09-17 16:21 ` Carlo Arenas
1 sibling, 0 replies; 5+ messages in thread
From: Carlo Arenas @ 2021-09-17 16:21 UTC (permalink / raw)
To: Bagas Sanjaya; +Cc: Git Users
you might want this in --global instead, but assuming it is ok to be
repository specific:
$ git config foobar.something baz
and in your script
baz=$(git config foobar.something)
Carlo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [QUESTION] How to add new configuration variable
2021-09-17 15:20 ` Đoàn Trần Công Danh
@ 2021-09-17 20:02 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2021-09-17 20:02 UTC (permalink / raw)
To: Đoàn Trần Công Danh
Cc: Konstantin Ryabitsev, Bagas Sanjaya, Git Users
Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:
> On 2021-09-17 09:43:18-0400, Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
>> On Fri, Sep 17, 2021 at 05:44:42PM +0700, Bagas Sanjaya wrote:
>> > 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-17 20:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 10:44 [QUESTION] How to add new configuration variable Bagas Sanjaya
2021-09-17 13:43 ` Konstantin Ryabitsev
2021-09-17 15:20 ` Đoàn Trần Công Danh
2021-09-17 20:02 ` Junio C Hamano
2021-09-17 16:21 ` Carlo Arenas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.