diff.c: move diffcore_skip_stat_unmatch core logic out for reuse later
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
2f93541d88
commit
fceb907225
25
diff.c
25
diff.c
|
@ -4592,16 +4592,8 @@ static int diff_filespec_is_identical(struct diff_filespec *one,
|
||||||
return !memcmp(one->data, two->data, one->size);
|
return !memcmp(one->data, two->data, one->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
|
static int diff_filespec_check_stat_unmatch(struct diff_filepair *p)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
struct diff_queue_struct *q = &diff_queued_diff;
|
|
||||||
struct diff_queue_struct outq;
|
|
||||||
DIFF_QUEUE_CLEAR(&outq);
|
|
||||||
|
|
||||||
for (i = 0; i < q->nr; i++) {
|
|
||||||
struct diff_filepair *p = q->queue[i];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1. Entries that come from stat info dirtiness
|
* 1. Entries that come from stat info dirtiness
|
||||||
* always have both sides (iow, not create/delete),
|
* always have both sides (iow, not create/delete),
|
||||||
|
@ -4623,6 +4615,21 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
|
||||||
diff_populate_filespec(p->two, 1) ||
|
diff_populate_filespec(p->two, 1) ||
|
||||||
(p->one->size != p->two->size) ||
|
(p->one->size != p->two->size) ||
|
||||||
!diff_filespec_is_identical(p->one, p->two)) /* (2) */
|
!diff_filespec_is_identical(p->one, p->two)) /* (2) */
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct diff_queue_struct *q = &diff_queued_diff;
|
||||||
|
struct diff_queue_struct outq;
|
||||||
|
DIFF_QUEUE_CLEAR(&outq);
|
||||||
|
|
||||||
|
for (i = 0; i < q->nr; i++) {
|
||||||
|
struct diff_filepair *p = q->queue[i];
|
||||||
|
|
||||||
|
if (diff_filespec_check_stat_unmatch(p))
|
||||||
diff_q(&outq, p);
|
diff_q(&outq, p);
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue