Re: Re* git diff/log --check exitcode and PAGER environment variable
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:07
Johannes Schindelin [off-list ref] writes:
On Fri, 8 Aug 2008, "Peter Valdemar Mørch (Lists)" wrote:quoted
I don't want to be a troll... But in my original post, I write that git log exits with 0 even when there are --check failures *and* --no-pager is used.You seem to care enough. That is good. Because I will give you a few pointers to help yourself, and you can in return help us by submitting a patch: - the code to be changed lives in log-tree.c. Look for calls to the function log_tree_diff_flush(). You need to check the exit status after that (needs to be done only when DIFF_OPT_TST(opt->diffopt, EXIT_WITH_STATUS). - you can get at the exit status with the call diff_result_code(opt->diffopt, 0) (see the implementation in diff.c to find out what the 0 means, and why it is correct). - you need to accumulate the exit status (plural, with a long u) over all calls to log_tree_diff(), best thing would be to add a member to the log_info struct. - you need to test rev->loginfo->exit_code in the end, and return failure if it is non-zero. I think the place is in cmd_log_walk(). Bon chance, Dscho
Dscho, thanks for a nice writeup. And sorry, Peter, for being dense earlier. I somehow thought you were talking about "diff" but you are right; "log" has been solely used for "_view_ log with various format of diffs" and nobody wanted it to pay attention to individual diff's exit status so far (I am not saying "everybody wanted it not to pay attention to it" -- it was just nobody felt the need for log to report the diff exit status).