Merge branch 'maint-1.6.0' into maint
[gitweb.git] / diff-no-index.c
index 39868e2a8fa47e91f8d21814ac433b516fc9535c..60ed17470a6a2bf9bea202a04004b06d207a77d7 100644 (file)
@@ -200,13 +200,6 @@ void diff_no_index(struct rev_info *revs,
                die("git diff %s takes two paths",
                    no_index ? "--no-index" : "[--no-index]");
 
-       /*
-        * If the user asked for our exit code then don't start a
-        * pager or we would end up reporting its exit code instead.
-        */
-       if (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS))
-               setup_pager();
-
        diff_setup(&revs->diffopt);
        if (!revs->diffopt.output_format)
                revs->diffopt.output_format = DIFF_FORMAT_PATCH;
@@ -214,8 +207,10 @@ void diff_no_index(struct rev_info *revs,
                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 {
@@ -226,6 +221,13 @@ void diff_no_index(struct rev_info *revs,
                }
        }
 
+       /*
+        * If the user asked for our exit code then don't start a
+        * pager or we would end up reporting its exit code instead.
+        */
+       if (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS))
+               setup_pager();
+
        if (prefix) {
                int len = strlen(prefix);