# [Q] would it be bad to make /etc/gitconfig runtime configurable?

5 messages from 2016-09-27 to 2016-10-03. Participants: Junio C Hamano, Jeff King, Johannes Schindelin.
Thread: https://gitlist.dev/t/44174

## Junio C Hamano, 2016-09-27 17:05

Subject: [Q] would it be bad to make /etc/gitconfig runtime configurable?
Message-ID: <xmqqoa39p926.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqoa39p926.fsf%40gitster.mtv.corp.google.com

```
The subject says it all.  Would it be bad if we introduce an
environment variable, GIT_SYSTEM_CONFIG=/etc/gitconfig, that names
an alternative location of the system-wide configuration file?

That would supersede/deprecate GIT_CONFIG_NOSYSTEM that we
introduced primarily so that we can run our tests without getting
affected by the configuration that happens to be effective on the
host that the test is being run.


```

## Jeff King, 2016-09-27 19:25

Subject: Re: [Q] would it be bad to make /etc/gitconfig runtime configurable?
Message-ID: <20160927192539.ybooc34iodnzs2ab@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20160927192539.ybooc34iodnzs2ab%40sigill.intra.peff.net
In-Reply-To: <xmqqoa39p926.fsf@gitster.mtv.corp.google.com>

```
On Tue, Sep 27, 2016 at 10:05:37AM -0700, Junio C Hamano wrote:

> The subject says it all.  Would it be bad if we introduce an
> environment variable, GIT_SYSTEM_CONFIG=/etc/gitconfig, that names
> an alternative location of the system-wide configuration file?
> 
> That would supersede/deprecate GIT_CONFIG_NOSYSTEM that we
> introduced primarily so that we can run our tests without getting
> affected by the configuration that happens to be effective on the
> host that the test is being run.

I can't think of a reason it would be bad. There shouldn't be a security
question, as controlling the environment already lets you run arbitrary
code, override system config variables, etc.

I know when I was writing the tests for 0d44a2d (config: return
configset value for current_config_ functions, 2016-05-26) I had to omit
the "system" case, because we had no way of pointing at a specific file.
So I do not know whether a runtime system config variable would be
useful for users, but it would definitely make testing easier.

-Peff

```

## Johannes Schindelin, 2016-10-03 11:06

Subject: Re: [Q] would it be bad to make /etc/gitconfig runtime configurable?
Message-ID: <alpine.DEB.2.20.1610031303000.35196@virtualbox>
URL: https://gitlist.dev/e/alpine.DEB.2.20.1610031303000.35196%40virtualbox
In-Reply-To: <20160927192539.ybooc34iodnzs2ab@sigill.intra.peff.net>

```
Hi,

On Tue, 27 Sep 2016, Jeff King wrote:

> On Tue, Sep 27, 2016 at 10:05:37AM -0700, Junio C Hamano wrote:
> 
> > The subject says it all.  Would it be bad if we introduce an
> > environment variable, GIT_SYSTEM_CONFIG=/etc/gitconfig, that names
> > an alternative location of the system-wide configuration file?
> > 
> > That would supersede/deprecate GIT_CONFIG_NOSYSTEM that we
> > introduced primarily so that we can run our tests without getting
> > affected by the configuration that happens to be effective on the
> > host that the test is being run.
> 
> I can't think of a reason it would be bad.

I cannot think of any reason right now, either, but my gut tells me that
this needs to simmer a while in the backs of our minds, to give potential
reasons a chance to come forward.

What would be the use case, BTW? IOW what would it solve that cannot
already be solved by using XDG_CONFIG_HOME?

Ciao,
Dscho

```

## Jeff King, 2016-10-03 11:26

Subject: Re: [Q] would it be bad to make /etc/gitconfig runtime configurable?
Message-ID: <20161003112654.3vca4zmctslcudfz@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20161003112654.3vca4zmctslcudfz%40sigill.intra.peff.net
In-Reply-To: <alpine.DEB.2.20.1610031303000.35196@virtualbox>

```
On Mon, Oct 03, 2016 at 01:06:10PM +0200, Johannes Schindelin wrote:

> Hi,
> 
> On Tue, 27 Sep 2016, Jeff King wrote:
> 
> > On Tue, Sep 27, 2016 at 10:05:37AM -0700, Junio C Hamano wrote:
> > 
> > > The subject says it all.  Would it be bad if we introduce an
> > > environment variable, GIT_SYSTEM_CONFIG=/etc/gitconfig, that names
> > > an alternative location of the system-wide configuration file?
> > > 
> > > That would supersede/deprecate GIT_CONFIG_NOSYSTEM that we
> > > introduced primarily so that we can run our tests without getting
> > > affected by the configuration that happens to be effective on the
> > > host that the test is being run.
> > 
> > I can't think of a reason it would be bad.
> 
> I cannot think of any reason right now, either, but my gut tells me that
> this needs to simmer a while in the backs of our minds, to give potential
> reasons a chance to come forward.
> 
> What would be the use case, BTW? IOW what would it solve that cannot
> already be solved by using XDG_CONFIG_HOME?

The patches Junio posted later use it for the test suite (and I also
have had to skip some tests in the past related to system config because
of its lack).

I would also use it when doing git experiments on GitHub servers. We
keep several relevant config settings in /etc/gitconfig, so if I were to
say, build a new version of git and test how it repacked torvalds/linux,
I need to make sure it picks up the same config. Usually I do it by
baking in the right /etc/gitconfig at build time, but it would be less
annoying to be able to override it at run-time.

I admit both of those are uses for git _developers_, though, not git
_users_.

-Peff

```

## Junio C Hamano, 2016-10-03 16:24

Subject: Re: [Q] would it be bad to make /etc/gitconfig runtime configurable?
Message-ID: <xmqq1szx8kpj.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq1szx8kpj.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20161003112654.3vca4zmctslcudfz@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> I admit both of those are uses for git _developers_, though, not git
> _users_.

Yes, this is meant for developers and not users.

The initial question probably should have stated more explicitly,
e.g. "I am wondering if it would be helpful to developers if we add
this thing; does anybody think of a reason why exposing it to end
users is a bad idea?"

```
