diff options
author | 2019-05-19 16:45:26 +0900 | |
---|---|---|
committer | 2019-05-19 16:45:26 +0900 | |
commit | 18cfb74f31209007e3a960efa594c25abd8a4cac (patch) | |
tree | 1151ef8fbcd62c6463f5594e80603dc9e546e44b /contrib | |
parent | Merge branch 'dl/warn-tagging-a-tag' (diff) | |
parent | diff-highlight: use correct /dev/null for UNIX and Windows (diff) | |
download | tgif-18cfb74f31209007e3a960efa594c25abd8a4cac.tar.xz |
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 Windows
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/diff-highlight/DiffHighlight.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/diff-highlight/DiffHighlight.pm b/contrib/diff-highlight/DiffHighlight.pm index 536754583b..7440aa1c46 100644 --- a/contrib/diff-highlight/DiffHighlight.pm +++ b/contrib/diff-highlight/DiffHighlight.pm @@ -4,6 +4,11 @@ use 5.008; use warnings FATAL => 'all'; 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 # other things like bold or underline if you prefer. my @OLD_HIGHLIGHT = ( @@ -134,7 +139,7 @@ sub highlight_stdin { # fallback, which means we will work even if git can't be run. sub color_config { 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; } |