git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Configuration overrides via environment variable
@ 2008-01-28  1:08 David Symonds
  2008-01-28 20:58 ` Jan Hudec
  0 siblings, 1 reply; 4+ messages in thread
From: David Symonds @ 2008-01-28  1:08 UTC (permalink / raw)
  To: Git Mailing List

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Configuration overrides via environment variable
  2008-01-28  1:08 Configuration overrides via environment variable David Symonds
@ 2008-01-28 20:58 ` Jan Hudec
  2008-01-28 22:58   ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Hudec @ 2008-01-28 20:58 UTC (permalink / raw)
  To: David Symonds; +Cc: Git Mailing List

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 <bulb@ucw.cz>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Configuration overrides via environment variable
  2008-01-28 20:58 ` Jan Hudec
@ 2008-01-28 22:58   ` Jakub Narebski
  2008-01-28 23:11     ` David Symonds
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2008-01-28 22:58 UTC (permalink / raw)
  To: Jan Hudec; +Cc: David Symonds, Git Mailing List

Jan Hudec <bulb@ucw.cz> writes:

> On Mon, Jan 28, 2008 at 12:08:10 +1100, David Symonds wrote:
> > 
> > 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?
 
> > 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Configuration overrides via environment variable
  2008-01-28 22:58   ` Jakub Narebski
@ 2008-01-28 23:11     ` David Symonds
  0 siblings, 0 replies; 4+ messages in thread
From: David Symonds @ 2008-01-28 23:11 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Jan Hudec, Git Mailing List

On Jan 29, 2008 9:58 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> Jan Hudec <bulb@ucw.cz> writes:
>
> > On Mon, Jan 28, 2008 at 12:08:10 +1100, David Symonds wrote:
> > >
> > > 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-28 23:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-28  1:08 Configuration overrides via environment variable David Symonds
2008-01-28 20:58 ` Jan Hudec
2008-01-28 22:58   ` Jakub Narebski
2008-01-28 23:11     ` David Symonds

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 NNTP newsgroup(s).