Skip to content

Commit d57346d

Browse files
Cache parsing the git config to speed things up
1 parent 908184c commit d57346d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

diff-so-fancy

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,15 @@ sub git_config {
461461
return $default_value;
462462
}
463463

464-
my $raw = {};
464+
state $raw = {};
465+
if (%$raw && $search_key) {
466+
return $raw->{$search_key} || $default_value;
467+
}
468+
469+
if ($args->{debug}) {
470+
print "Parsing git config\n";
471+
}
472+
465473
foreach my $line (@$out) {
466474
if ($line =~ /=/) {
467475
my ($key,$value) = split("=",$line,2);

0 commit comments

Comments
 (0)