Skip to content

Commit 212b167

Browse files
committed
t9700: stop relying on implicit bare repo discovery
Currently, the "alternate bare repo" test case relies on Git discovering non-bare and bare repositories alike. However, the automatic discovery of bare repository represents a weakness that leaves Git users vulnerable. To that end, the `safe.bareRepository` config was introduced, but out of backwards-compatibility concerns, the default is not yet secure. To prepare for that default to switch to the secure one, where bare repositories are never discovered automatically but instead must be specified explicitly, let's do exactly that in this test case: specify it explicitly, via setting the environment variable `GIT_DIR`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 67dc68b commit 212b167

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/t9700/test.pl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,12 @@ sub adjust_dirsep {
153153
chdir($abs_repo_dir);
154154

155155
# open alternate bare repo
156-
my $r4 = Git->repository(Directory => "$abs_repo_dir/bare.git");
157-
is($r4->command_oneline(qw(log --format=%s)), "bare commit",
158-
"log of bare repo works");
156+
{
157+
local $ENV{GIT_DIR} = "$abs_repo_dir/bare.git";
158+
my $r4 = Git->repository(Directory => "$abs_repo_dir/bare.git");
159+
is($r4->command_oneline(qw(log --format=%s)), "bare commit",
160+
"log of bare repo works");
161+
}
159162

160163
# unquoting paths
161164
is(Git::unquote_path('abc'), 'abc', 'unquote unquoted path');

0 commit comments

Comments
 (0)