Skip to content

Commit

Permalink
MinGW: fix diff --no-index /dev/null ...
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Mar 8, 2009
1 parent 3b16739 commit 36adb4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions diff-no-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion t/t4012-diff-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
) &&
Expand Down

0 comments on commit 36adb4a

Please sign in to comment.