Merge branch 'cw/diff-highlight'
Portability fix for a diff-highlight tool (in contrib/). * cw/diff-highlight: diff-highlight: use correct /dev/null for UNIX and Windowsmaint
commit
18cfb74f31
|
@ -4,6 +4,11 @@ use 5.008;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
# Use the correct value for both UNIX and Windows (/dev/null vs nul)
|
||||||
|
use File::Spec;
|
||||||
|
|
||||||
|
my $NULL = File::Spec->devnull();
|
||||||
|
|
||||||
# Highlight by reversing foreground and background. You could do
|
# Highlight by reversing foreground and background. You could do
|
||||||
# other things like bold or underline if you prefer.
|
# other things like bold or underline if you prefer.
|
||||||
my @OLD_HIGHLIGHT = (
|
my @OLD_HIGHLIGHT = (
|
||||||
|
@ -134,7 +139,7 @@ sub highlight_stdin {
|
||||||
# fallback, which means we will work even if git can't be run.
|
# fallback, which means we will work even if git can't be run.
|
||||||
sub color_config {
|
sub color_config {
|
||||||
my ($key, $default) = @_;
|
my ($key, $default) = @_;
|
||||||
my $s = `git config --get-color $key 2>/dev/null`;
|
my $s = `git config --get-color $key 2>$NULL`;
|
||||||
return length($s) ? $s : $default;
|
return length($s) ? $s : $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue