diff: don't run pager if user asked for a diff style exit code
[git/git.git] / builtin-diff.c
index b48121e..8dc17b0 100644 (file)
@@ -235,6 +235,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        rev.diffopt.allow_external = 1;
        rev.diffopt.recursive = 1;
 
+       /* 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 (!rev.diffopt.exit_with_status)
+               setup_pager();
+
        /* Do we have --cached and not have a pending object, then
         * default to HEAD by hand.  Eek.
         */