git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Make tests independent of global config files
@ 2008-02-06  8:38 Jeff King
  2008-02-06  9:04 ` Jeff King
  2008-02-06  9:14 ` [PATCH] Make tests independent of global config files Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff King @ 2008-02-06  8:38 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On Thu, Feb 15, 2007 at 11:43:56AM +0100, Johannes Schindelin wrote:

> This was done by setting $HOME to somewhere bogus. A better method is
> to reuse $GIT_CONFIG, which was invented for ignoring the global
> config file explicitely.
> 
> Technically, setting GIT_CONFIG=.git/config could be wrong, but it
> passes all the tests, and we can keep the tests that way.

[Yes, this is a reply to an ancient message, but your "could be wrong"
turned out to be true.]

I ran across a bug in the test suite today, and it is caused by this
change. The problem is that setting GIT_CONFIG=.git/config means that if
we change directories, then we may silently fail to read the config
file. Oops.

In particular, this is covering up an incorrect test in t1500. One of
the things it does is more or less this:

  cd .git && git rev-parse --is-bare-repository

and expects it to say "true". The test passes. All fine and dandy,
except that it _isn't_ a bare repository, and if you run the test by
hand, it returns "false."

The problem is that it's looking for .git/.git/config and doesn't find
it, meaning that it never sees the "core.bare = false" setting, and
makes a guess from its location inside the git dir.

We could set GIT_CONFIG=$(pwd)/.git/config, but then that fails if the
test creates other repos.

We could go back to setting HOME to something bogus, but then we have no
way to suppress the reading of /etc/gitconfig (the only way to do so, I
think, is to set GIT_CONFIG).

So I think we are stuck adding in some environment magic to suppress the
reading of ETC_GITCONFIG, and doing something like:

unset GIT_CONFIG
GIT_ETC_CONFIG=$(pwd)/.git/nonexistant
GIT_LOCAL_CONFIG=$(pwd)/.git/nonexistant

Thoughts?

-Peff

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

end of thread, other threads:[~2008-02-06 10:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-06  8:38 [PATCH] Make tests independent of global config files Jeff King
2008-02-06  9:04 ` Jeff King
2008-02-06  9:07   ` [PATCH 1/2] allow GIT_CONFIG_ETC to override compile-time setting Jeff King
2008-02-06  9:07   ` [PATCH 2/2] fix config reading in tests Jeff King
2008-02-06  9:14 ` [PATCH] Make tests independent of global config files Junio C Hamano
2008-02-06  9:27   ` Jeff King
2008-02-06 10:11     ` [PATCH 1/2] allow suppressing of global and system config Jeff King
2008-02-06 10:11     ` [PATCH 2/2] fix config reading in tests Jeff King

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