Code

Merge branch 'maint-1.6.0' into maint-1.6.1
[git.git] / diff-no-index.c
index 12ff1f1eefde8ac33709cd423a980708cd38b072..a3e47a76e401a1b98891b15a406b5806a294af3d 100644 (file)
@@ -201,14 +201,14 @@ 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"))
                        i++;
-               else if (!strcmp(argv[i], "-q"))
+               else if (!strcmp(argv[i], "-q")) {
                        options |= DIFF_SILENT_ON_REMOVED;
+                       i++;
+               }
                else if (!strcmp(argv[i], "--"))
                        i++;
                else {
@@ -245,6 +245,9 @@ void diff_no_index(struct rev_info *revs,
        else
                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);