Teach git log --check to return an appropriate exit code
Signed-off-by: Peter Valdemar Mørch <peter@morch.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Peter Valdemar Mørch committed
Aug 11, 2008 at 08:46 UTC
036d17feda327c509c712dd1054a12d067166667
1 file changed
+9
builtin-log.c
+9
@@ -217,6 +217,11 @@ static int cmd_log_walk(struct rev_info *rev)
217
if (rev->early_output)
218
finish_early_output(rev);
219
220
+ /*
221
+ * For --check, the exit code is based on CHECK_FAILED being
222
+ * accumulated in rev->diffopt, so be careful to retain that state
223
+ * information if replacing rev->diffopt in this loop
224
+ */
225
while ((commit = get_revision(rev)) != NULL) {
226
log_tree_commit(rev, commit);
227
if (!rev->reflog_info) {
@@ -227,6 +232,10 @@ static int cmd_log_walk(struct rev_info *rev)
232
free_commit_list(commit->parents);
233
commit->parents = NULL;
234
}
235
+ if (rev->diffopt.output_format & DIFF_FORMAT_CHECKDIFF &&
236
+ DIFF_OPT_TST(&rev->diffopt, CHECK_FAILED)) {
237
+ return 02;
238
+ }
239
return 0;
240
}
241