Fix NHtext when GIT_DIR is not defined.

This commit is contained in:
keni
2015-03-17 18:47:15 +02:00
committed by Pasi Kallinen
parent ff7230a159
commit 9de92d55dc
+7
View File
@@ -15,6 +15,13 @@ use strict;
sub git_config { sub git_config {
my($section, $var) = @_; my($section, $var) = @_;
local($_); local($_);
# Sigh. Without GIT_DIR we have to do it the slow way, and sometimes we don't
# have GIT_DIR.
if(0 == length($ENV{GIT_DIR})){
my $raw = `git config --local --get $section.$var`;
chomp($raw);
return $raw
}
open(CONFIG, "<", "$ENV{GIT_DIR}/config") or die "Missing .git/config: $!"; open(CONFIG, "<", "$ENV{GIT_DIR}/config") or die "Missing .git/config: $!";
while(<CONFIG>){ while(<CONFIG>){
m/^\[$section]/ && do { m/^\[$section]/ && do {