new_tree_entry/release_tree_entry manage a stack of tree_entry structs to use as temporaries. Initializing them is the responsibility of the caller, both after allocation with xmalloc() when existing temporaries are exhausted and after used entries are pushed with release_tree_entry. parse_ls doesn't set root->versions[0] fields, making root an invalid entry. The problem could arise if store_tree(root) is called. parse_ls calls store_tree on the node corresponding to the path it is called on. Do initialize entry->versions[0]. As of now, ls command can not list the topmost tree so this change is just to avoid surprises in case things will change around ls or tree_content_get. Signed-off-by: Dmitry Ivankov <divanorama@xxxxxxxxx> Acked-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- fast-import.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fast-import.c b/fast-import.c index 7cc2262..3a0aaad 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2951,6 +2951,9 @@ static void parse_ls(struct branch *b) } else { struct object_entry *e = parse_treeish_dataref(&p); root = new_tree_entry(); + hashclr(root->versions[0].sha1); + root->versions[0].mode = 0; + root->versions[1].mode = S_IFDIR; hashcpy(root->versions[1].sha1, e->idx.sha1); load_tree(root); if (*p++ != ' ') -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html