From d08b5a53d987163d2a12e3d3b8496243e2c3a217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Sat, 28 Sep 2024 22:02:27 +0200 Subject: [PATCH] Fix test failures on Ubuntu Refer to PR #22 and #23 for details --- t/20-simple.t | 6 ++++++ t/21-submodule.t | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/t/20-simple.t b/t/20-simple.t index 013383a..fc67e59 100644 --- a/t/20-simple.t +++ b/t/20-simple.t @@ -85,6 +85,12 @@ SKIP: { skip "this test does not work with msysgit on Win32", 2 if $^O eq 'MSWin32'; + # Thanks to @adelton and @gregora for the heads-up regarding change in behavior of git var GIT_EDITOR + # Refer to: https://github.com/book/Git-Repository/pull/23 + # for more information. + skip "'git var GIT_EDITOR' behaviour was changed in git 2.40.0, and we have $version", 2 + if Git::Repository->version_ge('2.40.0'); + ok( !eval { $r->run( var => 'GIT_EDITOR' ); 1; }, 'git var GIT_EDITOR' ); like( $@, diff --git a/t/21-submodule.t b/t/21-submodule.t index 444029c..6aa73bc 100644 --- a/t/21-submodule.t +++ b/t/21-submodule.t @@ -43,7 +43,18 @@ $s->run( checkout => 'master', { quiet => 1 } ); # now test adding a submodule my $r = test_repository(@init); + +# The "-c" option was introduced in 1.7.2, +# but protocol..allow was added in 2.12.0, +# and from that version protocol.file.allow defaulted to "always", +# from 2.38.1 however, protocol.file.allow default behavior changed to "user" +# For versions between 1.7.2 and 2.12.0, giving "-c protocol.file.allow=always" option +# is simply a no-op +# Thanks to @ap for the heads-up: Refer to: +# https://github.com/book/Git-Repository/pull/22#issuecomment-1404255657 +# for more information. $r->run( + ( Git::Repository->version_ge('1.7.2') ? ('-c', 'protocol.file.allow=always') : ()), submodule => add => $s->work_tree => 'sub', { env => { GIT_WORK_TREE => undef } } );