Skip to content

Commit

Permalink
diff --no-index: test for pager after option parsing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Jan 7, 2009
1 parent e423ffd commit c6dbca0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions diff-no-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,6 @@ void diff_no_index(struct rev_info *revs,
die("git diff %s takes two paths",
no_index ? "--no-index" : "[--no-index]");

/*
* 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 (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS))
setup_pager();

diff_setup(&revs->diffopt);
if (!revs->diffopt.output_format)
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
Expand All @@ -226,6 +219,13 @@ void diff_no_index(struct rev_info *revs,
}
}

/*
* 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 (!DIFF_OPT_TST(&revs->diffopt, EXIT_WITH_STATUS))
setup_pager();

if (prefix) {
int len = strlen(prefix);

Expand Down

0 comments on commit c6dbca0

Please sign in to comment.