Configuration overrides via environment variable

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

Configuration overrides via environment variable

From: David Symonds <hidden>
Date: 2016-06-15 22:44:08

Hi,

I'm using Git in some scripts, and wanted to get its colorised output
even when it is not going to a tty. I don't want to permanently change
~/.gitconfig or the per-repo config; I just want to set color.status
(and perhaps others) to "always" for a one-off run. I suppose I could
munge the config files, storing the previous value and restoring it
later, but that's messy.

Ideally, an environment variable like GIT_EXTRA_CONFIG or something
would be nice, so I could just do:

GIT_EXTRA_CONFIG="color.status=always" git status | ...

Thoughts? Does this already exist, and I've overlooked it?


Dave.

Re: Configuration overrides via environment variable

From: Jan Hudec <hidden>
Date: 2016-06-15 22:44:08

On Mon, Jan 28, 2008 at 12:08:10 +1100, David Symonds wrote:
Hi,

I'm using Git in some scripts, and wanted to get its colorised output
even when it is not going to a tty. I don't want to permanently change
~/.gitconfig or the per-repo config; I just want to set color.status
(and perhaps others) to "always" for a one-off run. I suppose I could
munge the config files, storing the previous value and restoring it
later, but that's messy.

Ideally, an environment variable like GIT_EXTRA_CONFIG or something
would be nice, so I could just do:

GIT_EXTRA_CONFIG="color.status=always" git status | ...

Thoughts? Does this already exist, and I've overlooked it?
Quickly looking at the git-config manpage, there does not seem to be a way to
provide alternate config file via GIT_CONFIG and/or GIT_CONFIG_LOCAL
variables. I don't know how good match for your problem that would be.

-- 
						 Jan 'Bulb' Hudec [off-list ref]

Re: Configuration overrides via environment variable

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:44:08

Jan Hudec [off-list ref] writes:
On Mon, Jan 28, 2008 at 12:08:10 +1100, David Symonds wrote:
quoted
I'm using Git in some scripts, and wanted to get its colorised output
even when it is not going to a tty. I don't want to permanently change
~/.gitconfig or the per-repo config; I just want to set color.status
(and perhaps others) to "always" for a one-off run. I suppose I could
munge the config files, storing the previous value and restoring it
later, but that's messy.
Cannot you just use --color option?
 
quoted
Ideally, an environment variable like GIT_EXTRA_CONFIG or something
would be nice, so I could just do:

GIT_EXTRA_CONFIG="color.status=always" git status | ...

Thoughts? Does this already exist, and I've overlooked it?
Quickly looking at the git-config manpage, there does not seem to be a way to
provide alternate config file via GIT_CONFIG and/or GIT_CONFIG_LOCAL
variables. I don't know how good match for your problem that would be.
GIT_CONFIG_LOCAL *replaces* repository configuration file; the global
and the system-wide configuration files will still be read. GIT_CONFIG
is the only config file read.

So you could I guess concatenate repo config with "[color] status=always",
although you would get warnings if color.status is already set...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

Re: Configuration overrides via environment variable

From: David Symonds <hidden>
Date: 2016-06-15 22:44:08

On Jan 29, 2008 9:58 AM, Jakub Narebski [off-list ref] wrote:
Jan Hudec [off-list ref] writes:
quoted
On Mon, Jan 28, 2008 at 12:08:10 +1100, David Symonds wrote:
quoted
I'm using Git in some scripts, and wanted to get its colorised output
even when it is not going to a tty. I don't want to permanently change
~/.gitconfig or the per-repo config; I just want to set color.status
(and perhaps others) to "always" for a one-off run. I suppose I could
munge the config files, storing the previous value and restoring it
later, but that's messy.
Cannot you just use --color option?
My version of Git (1.5.3.8) doesn't have a --color option for
git-status, and I can't find support for it in 'next', either. It
would be ideal if there was a --color option, though.


Dave.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help