Commit 71ae7601160aca672f2b13a461aab6e4aee7f9d0

Russell Belfer 2014-01-30T11:30:16

Force explicit remove of files instead of defer 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/checkout.c b/src/checkout.c
index f11ab8d..5b1f6cd 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -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;
 	}