Skip to content

Commit 908184c

Browse files
Use 'state' for git_config_raw()
1 parent 477079e commit 908184c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

diff-so-fancy

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -433,22 +433,20 @@ sub boolean {
433433
}
434434

435435
# Memoize getting the git config
436-
{
437-
my $static_config;
436+
sub git_config_raw {
437+
state $static_config;
438438

439-
sub git_config_raw {
440-
if ($static_config) {
441-
# If we already have the config return that
442-
return $static_config;
443-
}
439+
if ($static_config) {
440+
# If we already have the config return that
441+
return $static_config;
442+
}
444443

445-
my $cmd = "git config --list";
446-
my @out = `$cmd`;
444+
my $cmd = "git config --list";
445+
my @out = `$cmd`;
447446

448-
$static_config = \@out;
447+
$static_config = \@out;
449448

450-
return \@out;
451-
}
449+
return \@out;
452450
}
453451

454452
# Fetch a textual item from the git config

0 commit comments

Comments
 (0)