summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2023-10-02 02:40:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-10-02 21:57:40 (GMT)
commitefed687edcaa272601e0f4e192db368972daa7ac (patch)
tree4324acf56dc0100cc5fa0c14d8e88cf3e337323d /revision.c
parentd6222a2d05c93b22d5ef19b7361f7b1ef2964eb4 (diff)
downloadgit-efed687edcaa272601e0f4e192db368972daa7ac.zip
git-efed687edcaa272601e0f4e192db368972daa7ac.tar.gz
git-efed687edcaa272601e0f4e192db368972daa7ac.tar.bz2
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 2f4c53e..a60dfc2 100644
--- a/revision.c
+++ b/revision.c
@@ -82,7 +82,7 @@ static void mark_tree_contents_uninteresting(struct repository *r,
if (parse_tree_gently(tree, 1) < 0)
return;
- init_tree_desc(&desc, tree->buffer, tree->size);
+ init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size);
while (tree_entry(&desc, &entry)) {
switch (object_type(entry.mode)) {
case OBJ_TREE:
@@ -189,7 +189,7 @@ static void add_children_by_path(struct repository *r,
if (parse_tree_gently(tree, 1) < 0)
return;
- init_tree_desc(&desc, tree->buffer, tree->size);
+ init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size);
while (tree_entry(&desc, &entry)) {
switch (object_type(entry.mode)) {
case OBJ_TREE: