summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b599672)
raw | patch | inline | side by side (parent: b599672)
author | Larry D'Anna <larry@elder-gods.org> | |
Tue, 16 Feb 2010 06:55:21 +0000 (01:55 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 16 Feb 2010 07:04:34 +0000 (23:04 -0800) |
The option -w tells the diff machinery to inspect the contents to set the
exit status, instead of checking the blob object level difference alone.
However, --quiet tells the diff machinery not to look at the contents, which
means DIFF_FROM_CONTENTS has no chance to inspect the change.
Work it around by calling diff_flush_patch() with output sent to /dev/null.
Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
exit status, instead of checking the blob object level difference alone.
However, --quiet tells the diff machinery not to look at the contents, which
means DIFF_FROM_CONTENTS has no chance to inspect the change.
Work it around by calling diff_flush_patch() with output sent to /dev/null.
Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c | patch | blob | history |
index 381cc8d4fd69ca31fb8fc8af31422160e3ec1fd3..7216b1e8db75fb28916be85139b816e9c6be93f8 100644 (file)
--- a/diff.c
+++ b/diff.c
separator++;
}
+ if (output_format & DIFF_FORMAT_NO_OUTPUT &&
+ DIFF_OPT_TST(options, EXIT_WITH_STATUS) &&
+ DIFF_OPT_TST(options, DIFF_FROM_CONTENTS)) {
+ /*
+ * run diff_flush_patch for the exit status. setting
+ * options->file to /dev/null should be safe, becaue we
+ * aren't supposed to produce any output anyway.
+ */
+ if (options->close_file)
+ fclose(options->file);
+ options->file = fopen("/dev/null", "w");
+ if (!options->file)
+ die_errno("Could not open /dev/null");
+ options->close_file = 1;
+ for (i = 0; i < q->nr; i++) {
+ struct diff_filepair *p = q->queue[i];
+ if (check_pair_status(p))
+ diff_flush_patch(p, options);
+ if (options->found_changes)
+ break;
+ }
+ }
+
if (output_format & DIFF_FORMAT_PATCH) {
if (separator) {
putc(options->line_termination, options->file);