Skip to content

Commit c6dbca0

Browse files
trastgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e423ffd commit c6dbca0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

diff-no-index.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,6 @@ void diff_no_index(struct rev_info *revs,
200200
die("git diff %s takes two paths",
201201
no_index ? "--no-index" : "[--no-index]");
202202

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-
210203
diff_setup(&revs->diffopt);
211204
if (!revs->diffopt.output_format)
212205
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
@@ -226,6 +219,13 @@ void diff_no_index(struct rev_info *revs,
226219
}
227220
}
228221

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+
229229
if (prefix) {
230230
int len = strlen(prefix);
231231

0 commit comments

Comments
 (0)