From: Eric Wong Date: Wed, 22 May 2019 02:14:00 +0000 (+0000) Subject: git: workaround old git-rev-parse(1) (--git-path) X-Git-Tag: v1.2.0~266 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=97b45ccc7ae2f721744bd7ee1f1cbaab9e6df790 git: workaround old git-rev-parse(1) (--git-path) 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+ --- diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 236f70c1..a4daaa48 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -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; }; }