summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-11-09 17:51:06 (GMT)
committerJeff King <peff@peff.net>2012-11-09 17:51:06 (GMT)
commit19fb61369583410a4f79dbc065b4dc8125236c0b (patch)
tree7f7498d204f8df97ddc0cd6726154a0ce5fa5bb7 /diff.c
parent9d91c0e3d5d1bf9339a31ecbd5f6defdac8540d0 (diff)
parent745f7a8cacae55df3e00507344d8db2a31eb57e8 (diff)
downloadgit-19fb61369583410a4f79dbc065b4dc8125236c0b.zip
git-19fb61369583410a4f79dbc065b4dc8125236c0b.tar.gz
git-19fb61369583410a4f79dbc065b4dc8125236c0b.tar.bz2
Merge branch 'nd/builtin-to-libgit'
Code cleanups so that libgit.a does not depend on anything in the builtin/ directory. * nd/builtin-to-libgit: fetch-pack: move core code to libgit.a fetch-pack: remove global (static) configuration variable "args" send-pack: move core code to libgit.a Move setup_diff_pager to libgit.a Move print_commit_list to libgit.a Move estimate_bisect_steps to libgit.a Move try_merge_command and checkout_fast_forward to libgit.a
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 7fef69d..e89a201 100644
--- a/diff.c
+++ b/diff.c
@@ -4880,3 +4880,19 @@ size_t fill_textconv(struct userdiff_driver *driver,
return size;
}
+
+void setup_diff_pager(struct diff_options *opt)
+{
+ /*
+ * If the user asked for our exit code, then either they want --quiet
+ * or --exit-code. We should definitely not bother with a pager in the
+ * former case, as we will generate no output. Since we still properly
+ * report our exit code even when a pager is run, we _could_ run a
+ * pager with --exit-code. But since we have not done so historically,
+ * and because it is easy to find people oneline advising "git diff
+ * --exit-code" in hooks and other scripts, we do not do so.
+ */
+ if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
+ check_pager_config("diff") != 0)
+ setup_pager();
+}