diff: drop useless "status" parameter from diff_result_code()
Many programs use diff_result_code() to get a user-visible program exit code from a diff result (e.g., checking opts.found_changes if --exit-code was requested). This function also takes a "status" parameter, which seems at first glance that it could be used to propagate an error encountered when computing the diff. But it doesn't work that way: - negative values are passed through as-is, but are not appropriate as program exit codes - when --exit-code or --check is in effect, we _ignore_ the passed-in status completely. So a failed diff which did not have a chance to set opts.found_changes would erroneously report "success, no changes" instead of propagating the error. After recent cleanups, neither of these bugs is possible to trigger, as every caller just passes in "0". So rather than fixing them, we can simply drop the useless parameter instead. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
c0049ca0d7
commit
5cc6b2d70b
@ -549,7 +549,7 @@ static int cmd_log_walk_no_free(struct rev_info *rev)
|
||||
rev->diffopt.flags.check_failed) {
|
||||
return 02;
|
||||
}
|
||||
return diff_result_code(&rev->diffopt, 0);
|
||||
return diff_result_code(&rev->diffopt);
|
||||
}
|
||||
|
||||
static int cmd_log_walk(struct rev_info *rev)
|
||||
|
Reference in New Issue
Block a user