tree-walk: init_tree_desc take an oid to get the hash algorithm
To make it possible for git ls-tree to display the tree encoded in the hash algorithm of the oid specified to git ls-tree, update init_tree_desc to take as a parameter the oid of the tree object. Update all callers of init_tree_desc and init_tree_desc_gently to pass the oid of the tree object. Use the oid of the tree object to discover the hash algorithm of the oid and store that hash algorithm in struct tree_desc. Use the hash algorithm in decode_tree_entry and update_tree_entry_internal to handle reading a tree object encoded in a hash algorithm that differs from the repositories hash algorithm. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d6222a2d05
commit
efed687edc
@ -1756,7 +1756,8 @@ static void add_pbase_object(struct tree_desc *tree,
|
||||
tree = pbase_tree_get(&entry.oid);
|
||||
if (!tree)
|
||||
return;
|
||||
init_tree_desc(&sub, tree->tree_data, tree->tree_size);
|
||||
init_tree_desc(&sub, &tree->oid,
|
||||
tree->tree_data, tree->tree_size);
|
||||
|
||||
add_pbase_object(&sub, down, downlen, fullname);
|
||||
pbase_tree_put(tree);
|
||||
@ -1816,7 +1817,8 @@ static void add_preferred_base_object(const char *name)
|
||||
}
|
||||
else {
|
||||
struct tree_desc tree;
|
||||
init_tree_desc(&tree, it->pcache.tree_data, it->pcache.tree_size);
|
||||
init_tree_desc(&tree, &it->pcache.oid,
|
||||
it->pcache.tree_data, it->pcache.tree_size);
|
||||
add_pbase_object(&tree, name, cmplen, name);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user