fast-import: set valid mode on root tree in "ls"
authorJohn Keeping <john@keeping.me.uk>
Sun, 23 Jun 2013 14:58:20 +0000 (15:58 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 23 Jun 2013 21:22:28 +0000 (14:22 -0700)
This prevents a failure later when we lift the restriction on ls with
the empty path.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fast-import.c
index 5f539d7d8f7e087423734fb1d19e0d5e580fbe6e..ea1b3217fed57776eadb008f0659ad2f2dff515d 100644 (file)
@@ -3051,6 +3051,8 @@ static void parse_ls(struct branch *b)
                struct object_entry *e = parse_treeish_dataref(&p);
                root = new_tree_entry();
                hashcpy(root->versions[1].sha1, e->idx.sha1);
                struct object_entry *e = parse_treeish_dataref(&p);
                root = new_tree_entry();
                hashcpy(root->versions[1].sha1, e->idx.sha1);
+               if (!is_null_sha1(root->versions[1].sha1))
+                       root->versions[1].mode = S_IFDIR;
                load_tree(root);
                if (*p++ != ' ')
                        die("Missing space after tree-ish: %s", command_buf.buf);
                load_tree(root);
                if (*p++ != ' ')
                        die("Missing space after tree-ish: %s", command_buf.buf);