diff --check: minor fixups
There is no reason --exit-code and --check-diff must be mutually exclusive, so assign different bits to different results and allow them to be returned from the command. Introduce diff_result_code() to factor out the common code to decide final status code based on diffopt settings and use it everywhere. Update tests to match the above fix. Turning pager off when "diff --check" is used is a regression. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -44,9 +44,5 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
|
||||
return -1;
|
||||
}
|
||||
result = run_diff_index(&rev, cached);
|
||||
if (DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
|
||||
return DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0;
|
||||
if (rev.diffopt.output_format & DIFF_FORMAT_CHECKDIFF)
|
||||
return DIFF_OPT_TST(&rev.diffopt, CHECK_FAILED) != 0;
|
||||
return result;
|
||||
return diff_result_code(&rev.diffopt, result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user