]> git.proxmox.com Git - libgit2.git/commitdiff
Force explicit remove of files instead of defer
authorRussell Belfer <rb@github.com>
Thu, 30 Jan 2014 19:30:16 +0000 (11:30 -0800)
committerRussell Belfer <rb@github.com>
Thu, 30 Jan 2014 19:30:16 +0000 (11:30 -0800)
The checkout code used to defer removal of "blocking" files in
checkouts until the blocked item was actually being written (since
we have already checked that the removing the block is acceptable
according to the update rules).  Unfortunately, this resulted in
an intermediate index state where both the blocking and new items
were in the index which is no longer allowed.  Now we just remove
the blocking item in the first pass so it never needs to coexist.

In cases where there are typechanges, this could result in a bit
more churn of removing and recreating intermediate directories,
but I'm going to assume that is an unusual case and the churn will
not be too costly.

src/checkout.c

index f11ab8d460065c84bb0864ef2d28f09867b3c442..5b1f6cdcc7966d5c7aa8176c8072c4380785674e 100644 (file)
@@ -246,6 +246,8 @@ static int checkout_action_no_wd(
                        *action = CHECKOUT_ACTION_IF(SAFE, UPDATE_BLOB, NONE);
                break;
        case GIT_DELTA_DELETED: /* case 8 or 25 */
+               *action = CHECKOUT_ACTION__REMOVE;
+               break;
        default: /* impossible */
                break;
        }