Re: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows
- From
Chris Webster <chris@webstech.net>
- Date
- May 7, 2019, 04:18 UTC
- Message-ID
- <CAGT1KpVn536+B6-8=opNAVnz3_w13Kx3LyED0Gbk+4DtwmoP6Q@mail.gmail.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.1811061501210.86@tvgsbejvaqbjf.bet>
I know these can take some time but is this pending any update from me? The accepted changes will be merged back into the diff-so-fancy project.
There was a question about other uses of /dev/null. In the contrib directory, there are a couple of uses.
contrib/buildsystems/engine.pl - not clear if this is still of use or always expects to always be running in a mingw type environment. contrib/mw-to-git/git-remote-mediawiki.perl - this is cloned from a separately maintained github project. Should any changes be issues on that project?
thanks, ...chris.
On Tue, Nov 6, 2018 at 6:02 AM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 51 quoted lines
>
> List,
>
> I have no idea why this mail made it to GitGitGadget's email account but
> not to the Git mailing list... Sorry about that.
>
> Ciao,
> Johannes
>
> On Wed, 31 Oct 2018, Chris. Webster via GitGitGadget wrote:
>
> > From: "Chris. Webster" <chris@webstech.net>
> >
> > 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: Chris. Webster <chris@webstech.net>
> > ---
> > contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > 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;
> > }
> >
> > --
> > gitgitgadget
> >