Skip to content

Commit 9ffea48

Browse files
Don't error out if git is not installed (#429)
1 parent 0b39dfb commit 9ffea48

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

diff-so-fancy

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ sub boolean {
454454

455455
# Get the git config
456456
sub git_config_raw {
457-
my $cmd = "git config --list";
457+
my $cmd = "git config --list 2>&1";
458458
my @out = `$cmd`;
459459

460460
return \@out;
@@ -1030,11 +1030,17 @@ sub get_terminal_width {
10301030

10311031
sub show_debug_info {
10321032
my @less = get_less_charset();
1033-
my $git_ver = trim(`git --version`);
1033+
my $git_ver = trim(`git --version 2>&1`);
10341034
$git_ver =~ s/[^\d.]//g;
10351035

1036+
if ($git_ver !~ /git/) {
1037+
$git_ver = "Unknown";
1038+
} else {
1039+
$git_ver = "v" . $git_ver;
1040+
}
1041+
10361042
print "Diff-so-fancy : v$VERSION\n";
1037-
print "Git : v$git_ver\n";
1043+
print "Git : $git_ver\n";
10381044
print "Perl : $^V\n";
10391045
print "\n";
10401046

0 commit comments

Comments
 (0)