diff options
author | Eric Wong <e@80x24.org> | 2019-01-10 04:53:10 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-01-10 06:46:49 +0000 |
commit | 50c822076abee76c3133ffc3482488392eecedfb (patch) | |
tree | 903752fbe9b3497cfaa67a8739d901223d91f9a9 /t/common.perl | |
parent | e041f5446ad266ee24e41a38e0090e2a65167606 (diff) | |
download | public-inbox-50c822076abee76c3133ffc3482488392eecedfb.tar.gz |
This allows v1 tests to continue working on git 1.8.0 for now. This allows git 2.1.4 packaged with Debian 8 ("jessie") to run old tests, at least. I suppose it's safe to drop Debian 7 ("wheezy") due to our dependency on git 1.8.0 for "merge-base --is-ancestor". Writing V2 repositories requires git 2.6 for "get-mark" support, so mask out tests for older gits.
Diffstat (limited to 't/common.perl')
-rw-r--r-- | t/common.perl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/common.perl b/t/common.perl index 688e30ad..e49a5965 100644 --- a/t/common.perl +++ b/t/common.perl @@ -39,4 +39,18 @@ sub spawn_listener { $pid; } +sub require_git ($;$) { + my ($req, $maybe) = @_; + my ($req_maj, $req_min) = split(/\./, $req); + my ($cur_maj, $cur_min) = (`git --version` =~ /version (\d+)\.(\d+)/); + + my $req_int = ($req_maj << 24) | ($req_min << 16); + my $cur_int = ($cur_maj << 24) | ($cur_min << 16); + if ($cur_int < $req_int) { + return 0 if $maybe; + plan skip_all => "git $req+ required, have $git_ver"; + } + 1; +} + 1; |