Code

Merge branch 'maint'
[git.git] / fast-import.c
index 2317b0fe7509b957577234890135509143c0872b..8f68a892342f9fdfb968c4fbc7e17d92cca11765 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)