From dba002b9e521c639847650fbaeb8b87b66b9562e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 7 Mar 2009 16:36:09 +0100 Subject: [PATCH] MinGW: fix diff --no-index /dev/null ... When launching "diff --no-index" with a parameter "/dev/null", the MSys bash converts the "/dev/null" to a "nul", which usually makes sense. But diff --no-index got confused and tried to access a _file_ called "nul". While at it, the comment in t4012, expressed as ":# " was turned into ": " so that MSys' path name mangling does not kick in. With this patch, t4012 passes in msysGit. Signed-off-by: Johannes Schindelin --- diff-no-index.c | 4 ++++ t/t4012-diff-binary.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/diff-no-index.c b/diff-no-index.c index 0a14268ba9..598687b50a 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -38,6 +38,10 @@ static int get_mode(const char *path, int *mode) if (!path || !strcmp(path, "/dev/null")) *mode = 0; +#ifdef _WIN32 + else if (!strcasecmp(path, "nul")) + *mode = 0; +#endif else if (!strcmp(path, "-")) *mode = create_ce_mode(0666); else if (lstat(path, &st)) diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh index 3cf5b5c4ea..f64aa48d24 100755 --- a/t/t4012-diff-binary.sh +++ b/t/t4012-diff-binary.sh @@ -87,7 +87,7 @@ nul_to_q() { test_expect_success 'diff --no-index with binary creation' ' echo Q | q_to_nul >binary && - (:# hide error code from diff, which just indicates differences + (: hide error code from diff, which just indicates differences git diff --binary --no-index /dev/null binary >current || true ) && -- 2.11.4.GIT