]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git: workaround old git-rev-parse(1) (--git-path)
authorEric Wong <e@80x24.org>
Wed, 22 May 2019 02:14:00 +0000 (02:14 +0000)
committerEric Wong <e@80x24.org>
Wed, 22 May 2019 02:14:29 +0000 (02:14 +0000)
git < 2.5.0 was missing --git-path support.  This means any
users relying on some rare environment variables will need git
2.5.0+

lib/PublicInbox/Git.pm

index 236f70c165af6a275ab0898486cb7992700bae09..a4daaa48f0914f538e1232b66267384a2dafec0d 100644 (file)
@@ -59,6 +59,11 @@ sub git_path ($$) {
        $self->{-git_path}->{$path} ||= do {
                local $/ = "\n";
                chomp(my $str = $self->qx(qw(rev-parse --git-path), $path));
+
+               # git prior to 2.5.0 did not understand --git-path
+               if ($str eq "--git-path\n$path") {
+                       $str = "$self->{git_dir}/$path";
+               }
                $str;
        };
 }