From a883e5067e606357924216bb2c4859a0c386647b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20V=C3=B6gele?= Date: Sat, 19 Aug 2023 18:18:58 +0200 Subject: [PATCH 1/2] Add submodule with protocol.file.allow=always Git 2.38.1 considers file:// clones to be unsafe by default. --- t/deploy/git.t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/deploy/git.t b/t/deploy/git.t index cf4def11..cf774c64 100644 --- a/t/deploy/git.t +++ b/t/deploy/git.t @@ -166,7 +166,8 @@ subtest 'deploy with submodules and ignored files' => sub { # Git::Repository sets the "GIT_WORK_TREE" envvar, which makes most # submodule commands fail, so we have to unset it. - _git_run( $git, submodule => add => "file://$submoduledir", + _git_run( $git, qw( -c protocol.file.allow=always ), + submodule => add => "file://$submoduledir", { env => { GIT_WORK_TREE => undef } } ); _git_run( $git, commit => '-m' => 'add submodule' ); From 0f6afe77b945c47940cab591b63f2f610a9db568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20V=C3=B6gele?= Date: Sat, 19 Aug 2023 18:20:34 +0200 Subject: [PATCH 2/2] Don't pass "-b master" to old Git versions --- t/deploy/git.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/t/deploy/git.t b/t/deploy/git.t index cf774c64..8a5b1e02 100644 --- a/t/deploy/git.t +++ b/t/deploy/git.t @@ -391,7 +391,16 @@ done_testing; sub make_git { my ( $dir, %args ) = @_; - Git::Repository->run( "init", ( $args{bare} ? ( '--bare' ) : () ), '-b', 'master', "$dir" ); + my $git_version = Statocles::Deploy::Git->_git_version; + + my @options; + if ($args{bare}) { + push @options, '--bare'; + } + if ($git_version >= 2.028000) { + push @options, '-b', 'master'; + } + Git::Repository->run( "init", @options, "$dir" ); my $git = Git::Repository->new( work_tree => "$dir" );