X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=diff-no-index.c;h=aae8e7accc1ff955bd76c62b379b37f343f61cc4;hb=547e8b9205349b47003ed25a82673e413e71c255;hp=a3e47a76e401a1b98891b15a406b5806a294af3d;hpb=799fdb4ed0f9443122fdb85f6f73c58cb1de12ec;p=thirdparty%2Fgit.git diff --git a/diff-no-index.c b/diff-no-index.c index a3e47a76e4..aae8e7accc 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -38,9 +38,13 @@ 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 (stat(path, &st)) + else if (lstat(path, &st)) return error("Could not access '%s'", path); else *mode = st.st_mode; @@ -197,8 +201,8 @@ void diff_no_index(struct rev_info *revs, return; } if (argc != i + 2) - die("git diff %s takes two paths", - no_index ? "--no-index" : "[--no-index]"); + usagef("git diff %s ", + no_index ? "--no-index" : "[--no-index]"); diff_setup(&revs->diffopt); for (i = 1; i < argc - 2; ) { @@ -229,7 +233,7 @@ void diff_no_index(struct rev_info *revs, if (prefix) { int len = strlen(prefix); - revs->diffopt.paths = xcalloc(2, sizeof(char*)); + revs->diffopt.paths = xcalloc(2, sizeof(char *)); for (i = 0; i < 2; i++) { const char *p = argv[argc - 2 + i]; /*