git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	Git Users <git@vger.kernel.org>
Subject: Re: [QUESTION] How to add new configuration variable
Date: Fri, 17 Sep 2021 13:02:22 -0700	[thread overview]
Message-ID: <xmqqilyzgecx.fsf@gitster.g> (raw)
In-Reply-To: <YUSyNqd51euzvt8N@danh.dev> ("Đoàn Trần Công Danh"'s message of "Fri, 17 Sep 2021 22:20:43 +0700")

Đ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.

  reply	other threads:[~2021-09-17 20:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-09-17 16:21 ` Carlo Arenas

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=xmqqilyzgecx.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=bagasdotme@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=konstantin@linuxfoundation.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).