apply: a bit more comments on PATH_TO_BE_DELETED
The code is littered with to_be_deleted() whose purpose is not so clear. Describe where it matters. Also remove an extra space before "#define" that snuck in by mistake at 7fac0ee (builtin-apply: keep information about files to be deleted, 2009-04-11). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
May 16, 2012 at 13:21 UTC
f3b8f91a6919c8ab806016791c4a4bfd63c5169c
1 file changed
+8
-2
builtin/apply.c
+8
-2
@@ -2970,9 +2970,15 @@ static struct patch *in_fn_table(const char *name)
2970
* item->util in the filename table records the status of the path.
2971
* Usually it points at a patch (whose result records the contents
2972
* of it after applying it), but it could be PATH_WAS_DELETED for a
2973
- * path that a previously applied patch has already removed.
2973
+ * path that a previously applied patch has already removed, or
2974
+ * PATH_TO_BE_DELETED for a path that a later patch would remove.
2975
+ *
2976
+ * The latter is needed to deal with a case where two paths A and B
2977
+ * are swapped by first renaming A to B and then renaming B to A;
2978
+ * moving A to B should not be prevented due to presense of B as we
2979
+ * will remove it in a later patch.
2980
*/
2975
- #define PATH_TO_BE_DELETED ((struct patch *) -2)
2981
+#define PATH_TO_BE_DELETED ((struct patch *) -2)
2982
#define PATH_WAS_DELETED ((struct patch *) -1)
2983
2984
static int to_be_deleted(struct patch *patch)