@matheusbsbs / matheus-bagliano / commits / 36adb4abbd
Fork 0

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 Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Mar 7, 2009 at 16:51 UTC 36adb4abbdf809371b88581c8bf7fe9ea9a5b00a
2 files changed +5 -1
diff-no-index.c
+4
@@ -38,6 +38,10 @@ static int get_mode(const char *path, int *mode)
38
39 if (!path || !strcmp(path, "/dev/null"))
40 *mode = 0;
41 +#ifdef _WIN32
42 + else if (!strcasecmp(path, "nul"))
43 + *mode = 0;
44 +#endif
45 else if (!strcmp(path, "-"))
46 *mode = create_ce_mode(0666);
47 else if (lstat(path, &st))
t/t4012-diff-binary.sh
+1 -1
@@ -87,7 +87,7 @@ nul_to_q() {
87
88 test_expect_success 'diff --no-index with binary creation' '
89 echo Q | q_to_nul >binary &&
90 - (:# hide error code from diff, which just indicates differences
90 + (: hide error code from diff, which just indicates differences
91 git diff --binary --no-index /dev/null binary >current ||
92 true
93 ) &&