Skip to content

Commit

Permalink
Fix test failures on Ubuntu
Browse files Browse the repository at this point in the history
Refer to PR book#22 and book#23 for details
  • Loading branch information
hakonhagland committed Sep 28, 2024
1 parent cf322fc commit d08b5a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions t/20-simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -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(
$@,
Expand Down
11 changes: 11 additions & 0 deletions t/21-submodule.t
Original file line number Diff line number Diff line change
Expand Up @@ -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.<name>.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 } }
);
Expand Down

0 comments on commit d08b5a5

Please sign in to comment.