summaryrefslogtreecommitdiff
path: root/builtin-diff.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2007-08-12 17:46:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-08-13 20:06:23 (GMT)
commit89d07f750a3f878c42b3de96ee93dc571b42b230 (patch)
tree9f841785ead20a6a67e0e15353b2449aa6b65f00 /builtin-diff.c
parent4b37666ccbab015e75fda745c29a2f5d58a54482 (diff)
downloadgit-89d07f750a3f878c42b3de96ee93dc571b42b230.zip
git-89d07f750a3f878c42b3de96ee93dc571b42b230.tar.gz
git-89d07f750a3f878c42b3de96ee93dc571b42b230.tar.bz2
diff: don't run pager if user asked for a diff style exit code
As Wincent Colaiuta found out, it's a bit unexpected for git diff to start a pager even when the --quiet option is specified. The problem is that the pager hides the return code -- which is the only output we're interested in in this case. Push pager setup down into builtin-diff.c and don't start the pager if --exit-code or --quiet (which implies --exit-code) was specified. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-diff.c')
-rw-r--r--builtin-diff.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin-diff.c b/builtin-diff.c
index b48121e..8dc17b0 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -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.
*/