X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=fast-import.c;h=2317b0fe7509b957577234890135509143c0872b;hb=8fe5aeddcbeb194ea0f6e23e1f7b4ac38809921b;hp=dd51ac48b60d93031aa761d6731dd066c04e6989;hpb=6b5005c88b3a0c360249deb8ca8b92201abaa824;p=git.git diff --git a/fast-import.c b/fast-import.c index dd51ac48b..2317b0fe7 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1528,6 +1528,14 @@ static int tree_content_remove( for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; if (e->name->str_len == n && !strncmp(p, e->name->str_dat, n)) { + if (slash1 && !S_ISDIR(e->versions[1].mode)) + /* + * If p names a file in some subdirectory, and a + * file or symlink matching the name of the + * parent directory of p exists, then p cannot + * exist and need not be deleted. + */ + return 1; if (!slash1 || !S_ISDIR(e->versions[1].mode)) goto del_entry; if (!e->tree)