Merge branch 'jn/fast-import-empty-tree-removal' into maint
[gitweb.git] / fast-import.c
index 613623be14c4c647e11b20fefb382b3f7438fb3c..7563e43a39c4d4573218fab52ffbf64a255f2562 100644 (file)
@@ -2166,6 +2166,12 @@ static void file_change_m(struct branch *b)
                p = uq.buf;
        }
 
+       /* Git does not track empty, non-toplevel directories. */
+       if (S_ISDIR(mode) && !memcmp(sha1, EMPTY_TREE_SHA1_BIN, 20) && *p) {
+               tree_content_remove(&b->branch_tree, p, NULL);
+               return;
+       }
+
        if (S_ISGITLINK(mode)) {
                if (inline_data)
                        die("Git links cannot be specified 'inline': %s",