提交 6804ba3a 编写于 作者: C Chris. Webster 提交者: Junio C Hamano

diff-highlight: use correct /dev/null for UNIX and Windows

Use File::Spec->devnull() for output redirection to avoid messages
when Windows version of Perl is first in path.  The message 'The
system cannot find the path specified.' is displayed each time git is
run to get colors.
Signed-off-by: NChris. Webster <chris@webstech.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 8104ec99
......@@ -4,6 +4,11 @@ package DiffHighlight;
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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册