Skip to content

Commit

Permalink
Make tests work with detached git dir
Browse files Browse the repository at this point in the history
In my jenkins replacement, I run all tests with .git outside the work tree,
pointed to by $GIT_DIR. This is fairly common git practice, so let's make the
testsuite support this and run the relevant porting tests that are skipped
without this patch.
  • Loading branch information
seveas authored and tonycoz committed Dec 16, 2013
1 parent c260629 commit 6b44ec6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Porting/cmpVERSION.pl
Expand Up @@ -32,7 +32,7 @@
die "$0: This does not look like a Perl directory\n"
unless -f "perl.h" && -d "Porting";
die "$0: 'This is a Perl directory but does not look like Git working directory\n"
unless -d ".git";
unless (-d ".git" || (exists $ENV{GIT_DIR} && -d $ENV{GIT_DIR}));

my $null = devnull();

Expand Down
7 changes: 7 additions & 0 deletions t/test.pl
Expand Up @@ -176,6 +176,13 @@ sub find_git_or_skip {
}
$source_dir = $where;
}
} elsif (exists $ENV{GIT_DIR}) {
my $commit = '8d063cd8450e59ea1c611a2f4f5a21059a2804f1';
my $out = `git rev-parse --verify --quiet '$commit^{commit}'`;
chomp $out;
if($out eq $commit) {
$source_dir = '.'
}
}
if ($source_dir) {
my $version_string = `git --version`;
Expand Down

0 comments on commit 6b44ec6

Please sign in to comment.