]> granicus.if.org Git - nethack/commitdiff
Fix NHtext when GIT_DIR is not defined.
authorkeni <keni@his.com>
Mon, 2 Mar 2015 21:32:29 +0000 (16:32 -0500)
committerPasi Kallinen <paxed@alt.org>
Tue, 17 Mar 2015 16:47:15 +0000 (18:47 +0200)
DEVEL/hooksdir/NHtext

index 861b9e6b1bb8289ffb407ad3b4385e4fc133ca1f..0cc065db36a414834e87f3d03740cee05bfcc463 100755 (executable)
@@ -15,6 +15,13 @@ use strict;
 sub git_config {
        my($section, $var) = @_;
        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: $!";
        while(<CONFIG>){
                m/^\[$section]/ && do {