Skip to content

Commit 3cc6a6f

Browse files
peffgitster
authored andcommitted
t: stop using GIT_CONFIG to cross repo boundaries
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. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 221bf98 commit 3cc6a6f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

t/t0001-init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ check_config () {
1212
echo "expected a directory $1, a file $1/config and $1/refs"
1313
return 1
1414
fi
15-
bare=$(GIT_CONFIG="$1/config" git config --bool core.bare)
16-
worktree=$(GIT_CONFIG="$1/config" git config core.worktree) ||
15+
bare=$(cd "$1" && git config --bool core.bare)
16+
worktree=$(cd "$1" && git config core.worktree) ||
1717
worktree=unset
1818

1919
test "$bare" = "$2" && test "$worktree" = "$3" || {

t/t5701-clone-local.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ test_expect_success 'preparing origin repository' '
1212
: >file && git add . && git commit -m1 &&
1313
git clone --bare . a.git &&
1414
git clone --bare . x &&
15-
test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
16-
test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true &&
15+
test "$(cd a.git && git config --bool core.bare)" = true &&
16+
test "$(cd x && git config --bool core.bare)" = true &&
1717
git bundle create b1.bundle --all &&
1818
git bundle create b2.bundle master &&
1919
mkdir dir &&
@@ -24,7 +24,7 @@ test_expect_success 'preparing origin repository' '
2424
test_expect_success 'local clone without .git suffix' '
2525
git clone -l -s a b &&
2626
(cd b &&
27-
test "$(GIT_CONFIG=.git/config git config --bool core.bare)" = false &&
27+
test "$(git config --bool core.bare)" = false &&
2828
git fetch)
2929
'
3030

0 commit comments

Comments
 (0)