Skip to content

Commit f3d66fa

Browse files
committed
t1900: avoid using -C <dir> for a bare repository
To prepare for `safe.bareRepository` defaulting to `explicit` (see 8d1a744), add an optional 6th parameter `repo_flag` (defaulting to `-C`) to the `test_repo_info` helper, and use it in the caller that wants to operate on a bare repository. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 3626a8a commit f3d66fa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

t/t1900-repo-info.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ test_repo_info () {
2020
repo_name=$3
2121
key=$4
2222
expected_value=$5
23+
repo_flag=${6:--C}
2324

2425
test_expect_success "setup: $label" '
2526
eval "$init_command $repo_name"
2627
'
2728

2829
test_expect_success "lines: $label" '
2930
echo "$key=$expected_value" > expect &&
30-
git -C "$repo_name" repo info "$key" >actual &&
31+
git $repo_flag "$repo_name" repo info "$key" >actual &&
3132
test_cmp expect actual
3233
'
3334

3435
test_expect_success "nul: $label" '
3536
printf "%s\n%s\0" "$key" "$expected_value" >expect &&
36-
git -C "$repo_name" repo info --format=nul "$key" >actual &&
37+
git $repo_flag "$repo_name" repo info --format=nul "$key" >actual &&
3738
test_cmp_bin expect actual
3839
'
3940
}
@@ -48,7 +49,7 @@ test_repo_info 'bare repository = false is retrieved correctly' \
4849
'git init' 'nonbare' 'layout.bare' 'false'
4950

5051
test_repo_info 'bare repository = true is retrieved correctly' \
51-
'git init --bare' 'bare' 'layout.bare' 'true'
52+
'git init --bare' 'bare' 'layout.bare' 'true' '--git-dir'
5253

5354
test_repo_info 'shallow repository = false is retrieved correctly' \
5455
'git init' 'nonshallow' 'layout.shallow' 'false'

0 commit comments

Comments
 (0)