msvc: opendir: fix malloc-failure
[git.git] / fast-import.c
index eab68d58c394a67f4805d77b0007b583e79e24b9..77549ebd6fbfbea051901d4ab474eebc8e2dbdbd 100644 (file)
@@ -1454,6 +1454,15 @@ static int tree_content_set(
                n = slash1 - p;
        else
                n = strlen(p);
+       if (!slash1 && !n) {
+               if (!S_ISDIR(mode))
+                       die("Root cannot be a non-directory");
+               hashcpy(root->versions[1].sha1, sha1);
+               if (root->tree)
+                       release_tree_content_recursive(root->tree);
+               root->tree = subtree;
+               return 1;
+       }
        if (!n)
                die("Empty path component found in input");
        if (!slash1 && !S_ISDIR(mode) && subtree)