@matheusbsbs / matheus-bagliano / commits / c6dbca08ca
Fork 0

diff --no-index: test for pager after option parsing

We need to parse options before we can see if --exit-code was provided. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Rast committed Jan 7, 2009 at 00:56 UTC c6dbca08ca39d9cd511a36cdd18847b8720f1653
1 file changed +7 -7
diff-no-index.c
+7 -7
@@ -200,13 +200,6 @@ void diff_no_index(struct rev_info *revs,
200 die("git diff %s takes two paths",
201 no_index ? "--no-index" : "[--no-index]");
202
203 - /*
204 - * If the user asked for our exit code then don't start a
205 - * pager or we would end up reporting its exit code instead.
206 - */
207 - if (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS))
208 - setup_pager();
209 -
203 diff_setup(&revs->diffopt);
204 if (!revs->diffopt.output_format)
205 revs->diffopt.output_format = DIFF_FORMAT_PATCH;
@@ -226,6 +219,13 @@ void diff_no_index(struct rev_info *revs,
219 }
220 }
221
222 + /*
223 + * If the user asked for our exit code then don't start a
224 + * pager or we would end up reporting its exit code instead.
225 + */
226 + if (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS))
227 + setup_pager();
228 +
229 if (prefix) {
230 int len = strlen(prefix);
231