Skip to content

Instantly share code, notes, and snippets.

@Keith-S-Thompson
Last active June 14, 2018 17:36
Show Gist options
  • Save Keith-S-Thompson/3b8782a7a1dd6c385b7a5fe873ef8584 to your computer and use it in GitHub Desktop.
Save Keith-S-Thompson/3b8782a7a1dd6c385b7a5fe873ef8584 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
my %saved_env = %ENV;
my $term = $ENV{TERM};
my $error_count = 0;
foreach my $var (sort keys %saved_env) {
%ENV = ( TERM => $term, $var => $saved_env{$var});
my $lines = 0;
open my $PIPE, '-|', '/usr/bin/git', 'branch';
while (<$PIPE>) {
$lines ++;
}
close $PIPE;
if ($lines == 0) {
print "$var=$ENV{$var} causes git branch to produce no output\n";
$error_count ++;
}
}
if ($error_count == 0) {
print "No problem found\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment