# [PATCH] git-gui: '/dev/null' on Windows is named 'nul'

2 messages from 2007-03-07 to 2007-03-07. Participants: Johannes Sixt, Shawn O. Pearce.
Thread: https://gitlist.dev/t/7137

## Johannes Sixt, 2007-03-07 16:26

Subject: [PATCH] git-gui: '/dev/null' on Windows is named 'nul'
Message-ID: <45EEE7BA.E0603922@eudaptics.com>
URL: https://gitlist.dev/e/45EEE7BA.E0603922%40eudaptics.com

```
From: Johannes Sixt <johannes.sixt@telecom.at>

Making (or amending) an initial commit on Windows fails because
redirecting something to '/dev/null' must fail - this device does not exist.
Redirect to 'nul' instead.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 I've noticed this while using the MinGW port, but I do not know whether
 this is needed or even works on Cygwin.

 (Now lets see whether my MUA wraps long lines...)

 -- Hannes

 git-gui/git-gui.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index f84ba33..971d5fe 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -1288,7 +1288,11 @@ proc commit_committree {fd_wt curHEAD msg} {
 		}
 	} else {
 		# git commit-tree writes to stderr during initial commit.
-		lappend cmd 2>/dev/null
+		if {[is_Windows]} {
+			lappend cmd 2>nul
+		} else {
+			lappend cmd 2>/dev/null
+		}
 	}
 	lappend cmd <$msg_p
 	if {[catch {set cmt_id [eval exec $cmd]} err]} {
-- 
1.5.0.2.279.g4808

```

## Shawn O. Pearce, 2007-03-07 16:57

Subject: Re: [PATCH] git-gui: '/dev/null' on Windows is named 'nul'
Message-ID: <20070307165745.GA27922@spearce.org>
URL: https://gitlist.dev/e/20070307165745.GA27922%40spearce.org
In-Reply-To: <45EEE7BA.E0603922@eudaptics.com>

```
Johannes Sixt <J.Sixt@eudaptics.com> wrote:
> From: Johannes Sixt <johannes.sixt@telecom.at>
> 
> Making (or amending) an initial commit on Windows fails because
> redirecting something to '/dev/null' must fail - this device does not exist.
> Redirect to 'nul' instead.
> 
> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
> ---
>  I've noticed this while using the MinGW port, but I do not know whether
>  this is needed or even works on Cygwin.

I had previously fixed this in gitgui-0.6.3, which is now also
merged into `maint` in git.git.  It was fixed by just removing that
redirection block, in git 1.5.0 and later commit-tree doesn't print
anything on stderr when making an initial commit.
 
-- 
Shawn.

```
