Skip to content

Commit a3b047c

Browse files
committed
Merge branch 'cw/diff-highlight' into jch
* cw/diff-highlight: diff-highlight: use correct /dev/null for UNIX and Windows
2 parents 685a0c1 + 6804ba3 commit a3b047c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

contrib/diff-highlight/DiffHighlight.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ use 5.008;
44
use warnings FATAL => 'all';
55
use strict;
66

7+
# Use the correct value for both UNIX and Windows (/dev/null vs nul)
8+
use File::Spec;
9+
10+
my $NULL = File::Spec->devnull();
11+
712
# Highlight by reversing foreground and background. You could do
813
# other things like bold or underline if you prefer.
914
my @OLD_HIGHLIGHT = (
@@ -134,7 +139,7 @@ sub highlight_stdin {
134139
# fallback, which means we will work even if git can't be run.
135140
sub color_config {
136141
my ($key, $default) = @_;
137-
my $s = `git config --get-color $key 2>/dev/null`;
142+
my $s = `git config --get-color $key 2>$NULL`;
138143
return length($s) ? $s : $default;
139144
}
140145

0 commit comments

Comments
 (0)