]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fast-import.c
perl: bump the required Perl version to 5.8 from 5.6.[21]
[thirdparty/git.git] / fast-import.c
index dd51ac48b60d93031aa761d6731dd066c04e6989..2317b0fe7509b957577234890135509143c0872b 100644 (file)
@@ -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)