X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=diffcore-rename.c;h=8fb45f0b8706baa6a1190b21d723d0b0d81203c5;hb=aeac6681250440bc9801d6d6cc293cc708895b46;hp=19325f245c251b7a1bd6bd585eb05d7e3f51ca44;hpb=0e3994fa97e9876b571531444b97ae6e63fd744d;p=git.git diff --git a/diffcore-rename.c b/diffcore-rename.c index 19325f245..8fb45f0b8 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -249,8 +249,14 @@ void diffcore_rename(int detect_rename, int minimum_score) continue; /* unmerged */ else locate_rename_dst(p->two, 1); - else if (!DIFF_FILE_VALID(p->two)) - register_rename_src(p->one, 0); + else if (!DIFF_FILE_VALID(p->two)) { + /* If the source is a broken "delete", and + * they did not really want to get broken, + * that means the source actually stays. + */ + int stays = (p->broken_pair && !p->score); + register_rename_src(p->one, stays); + } else if (detect_rename == DIFF_DETECT_COPY) register_rename_src(p->one, 1); }