Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 04/12] t: stop using GIT_CONFIG to cross repo boundaries

From: Jeff King <hidden>
Date: 2016-06-15 23:00:26

On Fri, Mar 21, 2014 at 02:26:02PM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
Some tests want to check or set config in another
repository. E.g., t1000 creates repositories and makes sure
that their core.bare and core.worktree settings are what we
expect. We can do this with:

  GIT_CONFIG=$repo/.git/config git config ...

but it better shows the intent to just enter the repository
and let "git config" do the normal lookups:

  (cd $repo && git config ...)

In theory, this would cause us to use an extra subshell, but
in all such cases, we are actually already in a subshell.
Sure; alternatively we could use "git -C $there", but this rewrite
is fine by me.
The existing callers all pass actual $GIT_DIRs, so I initially wrote it
as "git --git-dir=$repo config ...". Doing it as "-C" is perhaps nicer,
as callers could potentially pass a shorter string to the repo root,
and not bother with adding "/.git". However, t0001 needs the actual
$GIT_DIR (because it looks for things like the refs/ directory in the
same function), and the other callers are just passing bare repos.

So I'm fine with any of them. Feel free to mark it up if you have a
preference.

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