"Alex Riesen" <raa.lkml@xxxxxxxxx> writes: >> To implement --quick correctly, you need to know when it is safe >> to leave early. Presence of -S (pickaxe) would most likely mean >> you shouldn't leave early. > > Thanks, that got me thinking. Moved all exit code evaluation > into diffcore_std, added a field for the code to diff_options, > and use it if called with --exit-code. Certainly --quick would be "interesting" and useful to add on top of your patch. > diff --git a/builtin-diff-files.c b/builtin-diff-files.c > index aec8338..2525ae6 100644 > --- a/builtin-diff-files.c > +++ b/builtin-diff-files.c > @@ -17,6 +17,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix) > { > struct rev_info rev; > int nongit = 0; > + int result; > > prefix = setup_git_directory_gently(&nongit); > init_revisions(&rev, prefix); > @@ -29,5 +30,6 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix) > argc = setup_revisions(argc, argv, &rev, NULL); > if (!rev.diffopt.output_format) > rev.diffopt.output_format = DIFF_FORMAT_RAW; > - return run_diff_files_cmd(&rev, argc, argv); > + result = run_diff_files_cmd(&rev, argc, argv); > + return rev.diffopt.diff_exit_code ? rev.diffopt.exit_code: result; > } Yuck. Let's call the former "exit_with_status" (meaning, the caller instructed us to do that) and the latter "has_changes". > +test_expect_failure 'git diff-index --cached HEAD^' ' > + echo text >>b && > + echo 3 >c && > + git add . && > + git diff-index --exit-code --cached HEAD^ > +' Please: test_expect_success '... echo ... && git add . && ! git diff-index ... ' I recall somebody on the list had a buggy shell that cannot handle "a && ! b" and tweaked a few tests to work around it. In that case... echo ... && git add . && { git diff-index ...; test $? != 0 } > +test_expect_failure 'git diff-files' ' > + echo 3 >>c && > + git diff-files --exit-code > +' Likewise > +git update-index c || error "update-index failed" Please do not have command outside test_expect without good reason. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html