Skip to contentSkip to conversation

DiffHighlight.pm: Use correct /dev/null for UNIX and Windows

PATCH Superseded Chris. Webster via GitGitGadget 6 participants 18 messages Oct 30, 2018 – May 12, 2019 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover DiffHighlight.pm: 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.

chris (1):
Use correct /dev/null for UNIX and Windows

 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

base-commit: c670b1f876521c9f7cd40184bf7ed05aad843433
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-59%2Fwebstech%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-59/webstech/master-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/59

Signature · 1 line
gitgitgadget
#1 lore raw

PATCH 1/1 Use correct /dev/null for UNIX and Windows

From: chris <[email protected]>

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.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
contrib/diff-highlight/DiffHighlight.pm +6 -1
index 536754583..7440aa1c4 100644
@@ -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;
 }
 
Signature · 1 line
gitgitgadget
#2 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

Quoted 1 line · chris via GitGitGadget

From: chris <[email protected]>

You might want to adjust your user.name. :)

Quoted 4 lines

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.

Thanks, makes sense, and the patch looks good to me.

-Peff

#3 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

Quoted 5 lines · Jeff King
Quoted 1 line · chris via GitGitGadget

From: chris <[email protected]>

You might want to adjust your user.name. :)

Yes, absolutely. We'd want to see that the From: line and one of the Signed-off-by: lines are idential.

Quoted 6 lines
Quoted 4 lines

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.

Thanks, makes sense, and the patch looks good to me.

Yup, and we already use File::Spec everywhere anyway, so this is not a new dependency, either. Which is very good.

#4 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

In reply to chris via GitGitGadget
Quoted 4 lines · chris via GitGitGadget

From: chris <[email protected]>

Use File::Spec->devnull() for output redirection to avoid messages when Windows version of Perl is first in path. The message 'The

Dscho, "Windows version of Perl is first in path" somehow feels contradicting with what one of the topics I saw from you were trying to enforce (or, at least, "set as the supported configuration").

I am guessing that the Perl you are building and shipping with Git for Windows would yield what the shell that ends up running the scriptlet git config --get-color $key prefers when asked for File::Spec->devnull(), and nothing will break with this patch even if that is "/dev/null", but I thought I'd double check.

Thanks.

Quoted 32 lines

system cannot find the path specified.' is displayed each time git is run to get colors.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
contrib/diff-highlight/DiffHighlight.pm +6 -1
index 536754583..7440aa1c4 100644
@@ -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;
 }

A message that is not in the archive (sent off-list or not yet received): CAGT1KpWoGD0xgTrC-+X1WqY_M=2arYbs4ZX6Nnj-zHK6mgu+nw@mail.gmail.com

#6 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

Resending in text mode.

Quoted 14 lines · Chris Webster
Quoted 12 lines · Junio C Hamano
Quoted 4 lines · chris via GitGitGadget

From: chris <[email protected]>

Use File::Spec->devnull() for output redirection to avoid messages when Windows version of Perl is first in path. The message 'The

Dscho, "Windows version of Perl is first in path" somehow feels contradicting with what one of the topics I saw from you were trying to enforce (or, at least, "set as the supported configuration").

Quoted 8 lines
Quoted 8 lines

I am guessing that the Perl you are building and shipping with Git for Windows would yield what the shell that ends up running the scriptlet git config --get-color $key prefers when asked for File::Spec->devnull(), and nothing will break with this patch even if that is "/dev/null", but I thought I'd double check.

Thanks.

This problem originally showed up in the
https://github.com/so-fancy/diff-so-fancy project, which has a copy of
DiffHighlight.pm. That project allows diffsofancy (perl) to be run
from the command line without requiring the bash environment ((well , sort of) including the associated perl).

Quoted 33 lines
Quoted 33 lines
Quoted 33 lines

system cannot find the path specified.' is displayed each time git is run to get colors.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
contrib/diff-highlight/DiffHighlight.pm +6 -1
index 536754583..7440aa1c4 100644
@@ -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;
 }
#7 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

Quoted 13 lines · Chris Webster
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines

Use File::Spec->devnull() for output redirection to avoid messages when Windows version of Perl is first in path. The message 'The

Dscho, "Windows version of Perl is first in path" somehow feels contradicting with what one of the topics I saw from you were trying to enforce (or, at least, "set as the supported configuration").

I am guessing that the Perl you are building and shipping with Git for Windows would yield what the shell that ends up running the scriptlet git config --get-color $key prefers when asked for File::Spec->devnull(), and nothing will break with this patch even if that is "/dev/null", but I thought I'd double check.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Thanks.

This problem originally showed up in the
https://github.com/so-fancy/diff-so-fancy project, which has a copy of
DiffHighlight.pm. That project allows diffsofancy (perl) to be run
from the command line without requiring the bash environment ((well , sort of) including the associated perl).

Thanks for additional comments.

In any case, Windows is not my bailiwick, so I'll hope that the above comments from you would help Dscho in his response and wait. I know use of File::Spec->devnull() won't hurt POSIX folks so making sure this won't break Git for Windows is the primary thing I woudl worry about this patch.

#8 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

Hi Junio,

Quoted 23 lines · Junio C Hamano
Quoted 13 lines · Chris Webster
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines

Use File::Spec->devnull() for output redirection to avoid messages when Windows version of Perl is first in path. The message 'The

Dscho, "Windows version of Perl is first in path" somehow feels contradicting with what one of the topics I saw from you were trying to enforce (or, at least, "set as the supported configuration").

I am guessing that the Perl you are building and shipping with Git for Windows would yield what the shell that ends up running the scriptlet git config --get-color $key prefers when asked for File::Spec->devnull(), and nothing will break with this patch even if that is "/dev/null", but I thought I'd double check.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Thanks.

This problem originally showed up in the
https://github.com/so-fancy/diff-so-fancy project, which has a copy of
DiffHighlight.pm. That project allows diffsofancy (perl) to be run
from the command line without requiring the bash environment ((well , sort of) including the associated perl).

Quoted 7 lines

Thanks for additional comments.

In any case, Windows is not my bailiwick, so I'll hope that the above comments from you would help Dscho in his response and wait. I know use of File::Spec->devnull() won't hurt POSIX folks so making sure this won't break Git for Windows is the primary thing I woudl worry about this patch.

Indeed, the patch in question regards something I consider outside Git for Windows' realm. As Chris said, you can run this script from a PowerShell prompt, without any Git Bash (and without Git's Perl) involved.

I am fine with this patch, as long as the author name is fixed to match the name in the Signed-off-by: footer ;-) [*1*]

Ciao,
Dscho

Footnote *1*: This patch came in via GitGitGadget, and if I had infinite amounts of time, I would probably implement some rudimentary pre-checks, such as: does the Author: header match the first Signed-off-by: footer, is the commit message wrapped correctly, does the oneline have a prefix and continues lower-case, etc. And GitGitGadget would then point out the issues, possibly even try to fix them and push up the fixed commits.

If anybody agrees with these goals and is curious enough to dive into some Typescript programming, I'd be very happy to guide that person through implementing this ;-)

#9 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

Quoted 6 lines · Johannes Schindelin

Indeed, the patch in question regards something I consider outside Git for Windows' realm. As Chris said, you can run this script from a PowerShell prompt, without any Git Bash (and without Git's Perl) involved.

I am fine with this patch, as long as the author name is fixed to match the name in the Signed-off-by: footer ;-) [*1*]

Thanks, I'll find a corrected patch on the list (or manufacture it out of the original) and queue, then.

#10 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

In reply to chris via GitGitGadget
Quoted 1 line

Subject: Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

As this is only about contrib/diff-highlight, please make it clear that it is the area the patch affects on its title, i.e.

	Subject: diff-highlight: use File::Spec->devnull(), not /dev/null

or something like that.

Quoted 1 line

From: chris <[email protected]>

Please make this line read like

From: Chris Webster <[email protected]>

i.e. the author should be the person who is signing off that patch.

Quoted 9 lines

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.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

There are a handful more instances of /dev/null found if you do

	$ git grep /dev/null -- \*.pl \*.pm

The one in perl/Git.pm must be shared by scripts written in Perl, so it may be worth giving the same tweak to it, like this patch does to the highlight script.

Quoted 24 lines
contrib/diff-highlight/DiffHighlight.pm +6 -1
index 536754583..7440aa1c4 100644
@@ -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;
 }
#11 lore raw

Re: [PATCH 1/1] Use correct /dev/null for UNIX and Windows

Hi,

Quoted 7 lines · Junio C Hamano
Quoted 1 line

From: chris <[email protected]>

Please make this line read like

From: Chris Webster <[email protected]>

i.e. the author should be the person who is signing off that patch.

This is most likely recorded as the commit's author in the commit object... Chris, to fix it, make sure that your user.name is configured correctly, and then call git commit --amend --reset-author.

Quoted 10 lines
Quoted 9 lines

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.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 7 lines

There are a handful more instances of /dev/null found if you do

	$ git grep /dev/null -- \*.pl \*.pm

The one in perl/Git.pm must be shared by scripts written in Perl, so it may be worth giving the same tweak to it, like this patch does to the highlight script.

I do not think that perl/Git.pm is intended to run with any random Perl interpreter. It has to be one that has been verified to work correctly with the Perl code in perl/, and that code is notoriously reliant on POSIX behavior, hence our choice to go with MSYS2 Perl (there *is* a MINGW Perl package in Git for Windows' SDK, but it will most likely not work, in particular because of the missing Subversion bindings).

So I would restrict the search to contrib/\*.pl, contrib/\*.perl and contrib/\*.pm. The stuff in contrib/ is supposed to be semi-independent from the particular Git one is using (and from whatever Perl is shipped with it, if any).

Ciao,
Johannes

Quoted 25 lines
Quoted 24 lines
contrib/diff-highlight/DiffHighlight.pm +6 -1
index 536754583..7440aa1c4 100644
@@ -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;
 }
#12 lore raw

v2 cover DiffHighlight.pm: Use correct /dev/null for UNIX and Windows

In reply to Chris. Webster via GitGitGadget

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.

Chris. Webster (1):
diff-highlight: Use correct /dev/null for UNIX and Windows

 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

base-commit: c670b1f876521c9f7cd40184bf7ed05aad843433
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-59%2Fwebstech%2Fmaster-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-59/webstech/master-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/59

Range-diff vs v1:

1: 8159cbd1b8 ! 1: bcbffa1411 Use correct /dev/null for UNIX and Windows
@@ -1,6 +1,6 @@
-Author: chris <[email protected]>
+Author: Chris. Webster <[email protected]>

- Use correct /dev/null for UNIX and Windows
+ 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

Signature · 1 line
gitgitgadget

A message that is not in the archive (sent off-list or not yet received): bcbffa141116f869db40e4572f9824a3d090c20c.1541026721.git.gitgitgadget@gmail.com

#14 lore raw

Re: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows

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

Quoted 40 lines · Chris. Webster via GitGitGadget

From: "Chris. Webster" <[email protected]>

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.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
contrib/diff-highlight/DiffHighlight.pm +6 -1
index 536754583b..7440aa1c46 100644
@@ -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;
 }
 
Signature · 1 line
gitgitgadget
#15 lore raw

Re: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows

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.

Quoted 51 lines · Johannes Schindelin

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

Quoted 40 lines · Chris. Webster via GitGitGadget

From: "Chris. Webster" <[email protected]>

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.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
contrib/diff-highlight/DiffHighlight.pm +6 -2
index 536754583b..7440aa1c46 100644
@@ -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

#16 lore raw

Re: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows

Hi Chris,

Quoted 9 lines · Chris Webster

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.

While the contrib/buildsystems/engine.pl is not often used, it does provide a route for users of older Visual studio version.
I'm not sure if the mingw environment is relevant to its operation - I'd expect it (the generation of an .sln that would compile) to still work with the current MSYS2 basis, but the install process was never fully completed (an probably isn't a worthwhile project unless you have the particular itch to scratch).

The newer MSVC=1 build process using vcpkg has solved most of the issues, but I'm getting a couple of issues with some of the libraries/include paths with the latest VS2017, see issue #2186 / #2179 / https://groups.google.com/forum/#!topic/git-for-windows/Y99a0dzlVJY , though hopefully I'll get them sorted this week.

Quoted 59 lines

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.

Quoted 50 lines · Johannes Schindelin

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

Quoted 40 lines · Chris. Webster via GitGitGadget

From: "Chris. Webster" <[email protected]>

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.

---
  contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
contrib/diff-highlight/DiffHighlight.pm +6 -2
index 536754583b..7440aa1c46 100644
@@ -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

author
#17 lore raw

PATCH v2 1/1 diff-highlight: Use correct /dev/null for UNIX and Windows

In reply to a message not in the archive

Forwarding this mail to the Git mailing list, as the original did not make it there (for reasons unknown).

---------- Forwarded message ---------
From: Chris. Webster via GitGitGadget <[email protected]>
Date: Wed, Oct 31, 2018 at 11:58 PM
Subject: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows
To: <[email protected]>
Cc: Junio C Hamano <[email protected]>, Chris. Webster <[email protected]>

From: "Chris. Webster" <[email protected]>

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.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/contrib/diff-highlight/DiffHighlight.pm
index 536754583b..7440aa1c46 100644

contrib/diff-highlight/DiffHighlight.pm +6 -1
@@ -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

#18 lore raw

Re: Fwd: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows

Quoted 2 lines · Git Gadget

Forwarding this mail to the Git mailing list, as the original did not make it there (for reasons unknown).

It seems that the forwarding mechansim (if this weren't manual---I cannot tell) mangles whitespaces? No need to resend, as the receiving end manually fixed them up.

Thanks.

Quoted 50 lines

---------- Forwarded message ---------
From: Chris. Webster via GitGitGadget <[email protected]>
Date: Wed, Oct 31, 2018 at 11:58 PM
Subject: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows
To: <[email protected]>
Cc: Junio C Hamano <[email protected]>, Chris. Webster <[email protected]>

From: "Chris. Webster" <[email protected]>

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.

---
 contrib/diff-highlight/DiffHighlight.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
contrib/diff-highlight/DiffHighlight.pm +6 -2
index 536754583b..7440aa1c46 100644
@@ -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

#19 lore raw

Re: Fwd: [PATCH v2 1/1] diff-highlight: Use correct /dev/null for UNIX and Windows

Hi Junio,

Quoted 8 lines · Junio C Hamano
Quoted 2 lines · Git Gadget

Forwarding this mail to the Git mailing list, as the original did not make it there (for reasons unknown).

It seems that the forwarding mechansim (if this weren't manual---I cannot tell) mangles whitespaces? No need to resend, as the receiving end manually fixed them up.

I did send it manually, via the GMail interface (which I seem to be unable to use effectively).

Sorry for the trouble, and thanks for fixing it up.

For the record, you could also always just fetch from the tag. The mails GitGitGadget sends (unless I manually forward mails) are generated from those tags, so (modulo bugs) the sent patch and the commit(s) reachable from the published tag are identical.

In this instance, it would have been:

	git fetch https://github.com/gitgitgadget/git \
		pr-59/webstech/master-v2

Thank you,
Dscho