configure.ac: check for clock_gettime and CLOCK_MONOTONIC
[gitweb.git] / diffcore-break.c
index 44f8678d22ea466b0867591429bbcc3285cdaf91..5473493e10551633659d0727626ffc2273ef4f73 100644 (file)
@@ -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);