diffcore_filespec: add is_binary
diffcore-break and diffcore-rename would want to behave slightly differently depending on the binary-ness of the data, so add one bit to the filespec, as the structure is now passed down to diffcore_count_changes() function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 28, 2007 at 22:56 UTC
706098af6b53403b5ea3db9216fb99afbe06f52d
2 files changed
+17
diff.c
+16
@@ -3005,6 +3005,22 @@ void diffcore_std(struct diff_options *options)
3005
{
3006
if (options->quiet)
3007
return;
3008
+
3009
+ /*
3010
+ * break/rename count similarity differently depending on
3011
+ * the binary-ness.
3012
+ */
3013
+ if ((options->break_opt != -1) || (options->detect_rename)) {
3014
+ struct diff_queue_struct *q = &diff_queued_diff;
3015
+ int i;
3016
+
3017
+ for (i = 0; i < q->nr; i++) {
3018
+ struct diff_filepair *p = q->queue[i];
3019
+ p->one->is_binary = file_is_binary(p->one);
3020
+ p->two->is_binary = file_is_binary(p->two);
3021
+ }
3022
+ }
3023
+
3024
if (options->break_opt != -1)
3025
diffcore_break(options->break_opt);
3026
if (options->detect_rename)
diffcore.h
+1
@@ -37,6 +37,7 @@ struct diff_filespec {
37
#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
38
unsigned should_free : 1; /* data should be free()'ed */
39
unsigned should_munmap : 1; /* data should be munmap()'ed */
40
+ unsigned is_binary : 1; /* data should be considered "binary" */
41
};
42
43
extern struct diff_filespec *alloc_filespec(const char *);