X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=diff-no-index.c;h=42c1dd8ad3b0633767bf577975a895722f882565;hb=47abd85ba06ed7209d1caa3e5ac7cc6b232bece4;hp=2d541d9aba11ee69525a6a1ef5da6f8a61e9e65e;hpb=2990034f1ed2c3d85d23d5611a1f04d317f785ac;p=git.git diff --git a/diff-no-index.c b/diff-no-index.c index 2d541d9ab..42c1dd8ad 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; @@ -201,8 +205,6 @@ void diff_no_index(struct rev_info *revs, no_index ? "--no-index" : "[--no-index]"); diff_setup(&revs->diffopt); - if (!revs->diffopt.output_format) - revs->diffopt.output_format = DIFF_FORMAT_PATCH; for (i = 1; i < argc - 2; ) { int j; if (!strcmp(argv[i], "--no-index")) @@ -248,6 +250,8 @@ void diff_no_index(struct rev_info *revs, revs->diffopt.paths = argv + argc - 2; revs->diffopt.nr_paths = 2; revs->diffopt.skip_stat_unmatch = 1; + if (!revs->diffopt.output_format) + revs->diffopt.output_format = DIFF_FORMAT_PATCH; DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS); DIFF_OPT_SET(&revs->diffopt, NO_INDEX);