Skip to content

Commit 7da3f2f

Browse files
committed
tests: use test_config --git-dir for bare repos
As part of the preparation for `safe.bareRepository` defaulting to `explicit` (see 8d1a744), switch `test_config -C <bare>` to `test_config --git-dir <bare>` so the config helper accesses bare repos without implicit discovery. For your convenience, here is an awk command-line to verify this commit: It mechanically undoes the transformation on the new lines; empty output is success: git diff HEAD^! | awk ' /^diff/,/^\+\+\+/ { next } /^-/ { old[m++] = substr($0,2) } /^\+/ { new = substr($0,2) # undo: --git-dir -> -C gsub(/test_config --git-dir /, "test_config -C ", new) if (old[n++] != new) print old[n-1] " != " new }' Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 0cd2c74 commit 7da3f2f

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

t/t5410-receive-pack.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ test_expect_success 'with core.alternateRefsCommand' '
2626
--format="%(objectname)" \
2727
refs/heads/public/
2828
EOF
29-
test_config -C fork core.alternateRefsCommand ./alternate-refs &&
29+
test_config --git-dir fork core.alternateRefsCommand ./alternate-refs &&
3030
git rev-parse public/branch >expect &&
3131
printf "0000" | git receive-pack fork >actual &&
3232
extract_haves <actual >actual.haves &&
3333
test_cmp expect actual.haves
3434
'
3535

3636
test_expect_success 'with core.alternateRefsPrefixes' '
37-
test_config -C fork core.alternateRefsPrefixes "refs/heads/private" &&
37+
test_config --git-dir fork core.alternateRefsPrefixes "refs/heads/private" &&
3838
git rev-parse private/branch >expect &&
3939
printf "0000" | git receive-pack fork >actual &&
4040
extract_haves <actual >actual.haves &&

t/t5509-fetch-push-namespaces.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,25 @@ test_expect_success 'hide full refs with transfer.hideRefs' '
114114
'
115115

116116
test_expect_success 'try to update a hidden ref' '
117-
test_config -C pushee transfer.hideRefs refs/heads/main &&
117+
test_config --git-dir pushee transfer.hideRefs refs/heads/main &&
118118
test_must_fail git -C original push pushee-namespaced main
119119
'
120120

121121
test_expect_success 'try to update a ref that is not hidden' '
122-
test_config -C pushee transfer.hideRefs refs/namespaces/namespace/refs/heads/main &&
122+
test_config --git-dir pushee transfer.hideRefs refs/namespaces/namespace/refs/heads/main &&
123123
git -C original push pushee-namespaced main
124124
'
125125

126126
test_expect_success 'git-receive-pack(1) with transfer.hideRefs does not match unstripped refs during advertisement' '
127127
git -C pushee update-ref refs/namespaces/namespace/refs/heads/foo/1 refs/namespaces/namespace/refs/heads/main &&
128128
git -C pushee pack-refs --all &&
129-
test_config -C pushee transfer.hideRefs refs/namespaces/namespace/refs/heads/foo &&
129+
test_config --git-dir pushee transfer.hideRefs refs/namespaces/namespace/refs/heads/foo &&
130130
GIT_TRACE_PACKET="$(pwd)/trace" git -C original push pushee-namespaced main &&
131131
test_grep refs/heads/foo/1 trace
132132
'
133133

134134
test_expect_success 'try to update a hidden full ref' '
135-
test_config -C pushee transfer.hideRefs "^refs/namespaces/namespace/refs/heads/main" &&
135+
test_config --git-dir pushee transfer.hideRefs "^refs/namespaces/namespace/refs/heads/main" &&
136136
test_must_fail git -C original push pushee-namespaced main
137137
'
138138

t/t5606-clone-options.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ test_expect_success 'clone does not segfault with --bare and core.bare=false' '
171171
test_expect_success 'chooses correct default initial branch name' '
172172
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
173173
git -c init.defaultBranch=foo init --bare empty &&
174-
test_config -C empty lsrefs.unborn advertise &&
174+
test_config --git-dir empty lsrefs.unborn advertise &&
175175
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
176176
git -c init.defaultBranch=up -c protocol.version=2 clone empty whats-up &&
177177
test refs/heads/foo = $(git -C whats-up symbolic-ref HEAD) &&

t/t5616-partial-clone.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,40 +357,40 @@ test_expect_success 'upload-pack complains of bogus filter config' '
357357
'
358358

359359
test_expect_success 'upload-pack fails banned object filters' '
360-
test_config -C srv.bare uploadpackfilter.blob:none.allow false &&
360+
test_config --git-dir srv.bare uploadpackfilter.blob:none.allow false &&
361361
test_must_fail ok=sigpipe git clone --no-checkout --filter=blob:none \
362362
"file://$(pwd)/srv.bare" pc3 2>err &&
363363
test_grep "filter '\''blob:none'\'' not supported" err
364364
'
365365

366366
test_expect_success 'upload-pack fails banned combine object filters' '
367-
test_config -C srv.bare uploadpackfilter.allow false &&
368-
test_config -C srv.bare uploadpackfilter.combine.allow true &&
369-
test_config -C srv.bare uploadpackfilter.tree.allow true &&
370-
test_config -C srv.bare uploadpackfilter.blob:none.allow false &&
367+
test_config --git-dir srv.bare uploadpackfilter.allow false &&
368+
test_config --git-dir srv.bare uploadpackfilter.combine.allow true &&
369+
test_config --git-dir srv.bare uploadpackfilter.tree.allow true &&
370+
test_config --git-dir srv.bare uploadpackfilter.blob:none.allow false &&
371371
test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:1 \
372372
--filter=blob:none "file://$(pwd)/srv.bare" pc3 2>err &&
373373
test_grep "filter '\''blob:none'\'' not supported" err
374374
'
375375

376376
test_expect_success 'upload-pack fails banned object filters with fallback' '
377-
test_config -C srv.bare uploadpackfilter.allow false &&
377+
test_config --git-dir srv.bare uploadpackfilter.allow false &&
378378
test_must_fail ok=sigpipe git clone --no-checkout --filter=blob:none \
379379
"file://$(pwd)/srv.bare" pc3 2>err &&
380380
test_grep "filter '\''blob:none'\'' not supported" err
381381
'
382382

383383
test_expect_success 'upload-pack limits tree depth filters' '
384-
test_config -C srv.bare uploadpackfilter.allow false &&
385-
test_config -C srv.bare uploadpackfilter.tree.allow true &&
386-
test_config -C srv.bare uploadpackfilter.tree.maxDepth 0 &&
384+
test_config --git-dir srv.bare uploadpackfilter.allow false &&
385+
test_config --git-dir srv.bare uploadpackfilter.tree.allow true &&
386+
test_config --git-dir srv.bare uploadpackfilter.tree.maxDepth 0 &&
387387
test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:1 \
388388
"file://$(pwd)/srv.bare" pc3 2>err &&
389389
test_grep "tree filter allows max depth 0, but got 1" err &&
390390
391391
git clone --no-checkout --filter=tree:0 "file://$(pwd)/srv.bare" pc4 &&
392392
393-
test_config -C srv.bare uploadpackfilter.tree.maxDepth 5 &&
393+
test_config --git-dir srv.bare uploadpackfilter.tree.maxDepth 5 &&
394394
git clone --no-checkout --filter=tree:5 "file://$(pwd)/srv.bare" pc5 &&
395395
test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:6 \
396396
"file://$(pwd)/srv.bare" pc6 2>err &&

t/t5620-backfill.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ test_expect_success 'create a partial clone over HTTP' '
183183
SERVER="$HTTPD_DOCUMENT_ROOT_PATH/server" &&
184184
rm -rf "$SERVER" repo &&
185185
git clone --bare "file://$(pwd)/src" "$SERVER" &&
186-
test_config -C "$SERVER" uploadpack.allowfilter 1 &&
187-
test_config -C "$SERVER" uploadpack.allowanysha1inwant 1 &&
186+
test_config --git-dir "$SERVER" uploadpack.allowfilter 1 &&
187+
test_config --git-dir "$SERVER" uploadpack.allowanysha1inwant 1 &&
188188
189189
git clone --no-checkout --filter=blob:none \
190190
"$HTTPD_URL/smart/server" backfill-http

t/t5710-promisor-remote-capability.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ test_expect_success "clone with promisor.sendFields" '
304304
git -C server config remote.otherLop.stuff "baz" &&
305305
git -C server config remote.otherLop.partialCloneFilter "blob:limit=10k" &&
306306
test_when_finished "git -C server remote remove otherLop" &&
307-
test_config -C server promisor.sendFields "partialCloneFilter, token" &&
307+
test_config --git-dir server promisor.sendFields "partialCloneFilter, token" &&
308308
test_when_finished "rm trace" &&
309309
310310
# Clone from server to create a client
@@ -335,7 +335,7 @@ test_expect_success "clone with promisor.checkFields" '
335335
git -C server config remote.otherLop.stuff "baz" &&
336336
git -C server config remote.otherLop.partialCloneFilter "blob:limit=10k" &&
337337
test_when_finished "git -C server remote remove otherLop" &&
338-
test_config -C server promisor.sendFields "partialCloneFilter, token" &&
338+
test_config --git-dir server promisor.sendFields "partialCloneFilter, token" &&
339339
test_when_finished "rm trace" &&
340340
341341
# Clone from server to create a client
@@ -373,7 +373,7 @@ test_expect_success "clone with promisor.storeFields=partialCloneFilter" '
373373
git -C server config remote.lop.token "fooXXX" &&
374374
git -C server config remote.lop.partialCloneFilter "blob:limit=8k" &&
375375
376-
test_config -C server promisor.sendFields "partialCloneFilter, token" &&
376+
test_config --git-dir server promisor.sendFields "partialCloneFilter, token" &&
377377
test_when_finished "rm trace" &&
378378
379379
# Clone from server to create a client
@@ -428,7 +428,7 @@ test_expect_success "clone and fetch with --filter=auto" '
428428
test_when_finished "rm -rf client trace" &&
429429
430430
git -C server config remote.lop.partialCloneFilter "blob:limit=9500" &&
431-
test_config -C server promisor.sendFields "partialCloneFilter" &&
431+
test_config --git-dir server promisor.sendFields "partialCloneFilter" &&
432432
433433
GIT_TRACE_PACKET="$(pwd)/trace" GIT_NO_LAZY_FETCH=0 git clone \
434434
-c remote.lop.promisor=true \

t/t7700-repack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ test_expect_success 'no bitmaps created if .keep files present' '
320320
'
321321

322322
test_expect_success 'auto-bitmaps do not complain if unavailable' '
323-
test_config -C bare.git pack.packSizeLimit 1M &&
323+
test_config --git-dir bare.git pack.packSizeLimit 1M &&
324324
blob=$(test-tool genrandom big 1m |
325325
git -C bare.git hash-object -w --stdin) &&
326326
git -C bare.git update-ref refs/tags/big $blob &&

0 commit comments

Comments
 (0)