diff options
Diffstat (limited to 'diffcore-break.c')
-rw-r--r-- | diffcore-break.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/diffcore-break.c b/diffcore-break.c index 44f8678d22..5473493e10 100644 --- a/diffcore-break.c +++ b/diffcore-break.c @@ -68,6 +68,9 @@ static int should_break(struct diff_filespec *src, if (max_size < MINIMUM_BREAK_SIZE) return 0; /* we do not break too small filepair */ + if (!src->size) + return 0; /* we do not let empty files get renamed */ + if (diffcore_count_changes(src, dst, &src->cnt_data, &dst->cnt_data, 0, @@ -243,6 +246,13 @@ static void merge_broken(struct diff_filepair *p, dp = diff_queue(outq, d->one, c->two); dp->score = p->score; + /* + * We will be one extra user of the same src side of the + * broken pair, if it was used as the rename source for other + * paths elsewhere. Increment to mark that the path stays + * in the resulting tree. + */ + d->one->rename_used++; diff_free_filespec_data(d->two); diff_free_filespec_data(c->one); free(d); |