mirror of
https://github.com/git/git.git
synced 2024-11-30 21:44:02 +08:00
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>
This commit is contained in:
parent
d8c3d03a0b
commit
706098af6b
16
diff.c
16
diff.c
@ -3005,6 +3005,22 @@ void diffcore_std(struct diff_options *options)
|
|||||||
{
|
{
|
||||||
if (options->quiet)
|
if (options->quiet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* break/rename count similarity differently depending on
|
||||||
|
* the binary-ness.
|
||||||
|
*/
|
||||||
|
if ((options->break_opt != -1) || (options->detect_rename)) {
|
||||||
|
struct diff_queue_struct *q = &diff_queued_diff;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < q->nr; i++) {
|
||||||
|
struct diff_filepair *p = q->queue[i];
|
||||||
|
p->one->is_binary = file_is_binary(p->one);
|
||||||
|
p->two->is_binary = file_is_binary(p->two);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (options->break_opt != -1)
|
if (options->break_opt != -1)
|
||||||
diffcore_break(options->break_opt);
|
diffcore_break(options->break_opt);
|
||||||
if (options->detect_rename)
|
if (options->detect_rename)
|
||||||
|
@ -37,6 +37,7 @@ struct diff_filespec {
|
|||||||
#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
|
#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
|
||||||
unsigned should_free : 1; /* data should be free()'ed */
|
unsigned should_free : 1; /* data should be free()'ed */
|
||||||
unsigned should_munmap : 1; /* data should be munmap()'ed */
|
unsigned should_munmap : 1; /* data should be munmap()'ed */
|
||||||
|
unsigned is_binary : 1; /* data should be considered "binary" */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct diff_filespec *alloc_filespec(const char *);
|
extern struct diff_filespec *alloc_filespec(const char *);
|
||||||
|
Loading…
Reference in New Issue
Block a user