diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2023-10-01 21:40:28 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-10-02 14:57:40 -0700 |
| commit | efed687edcaa272601e0f4e192db368972daa7ac (patch) | |
| tree | 4324acf56dc0100cc5fa0c14d8e88cf3e337323d /tree-walk.h | |
| parent | d6222a2d05c93b22d5ef19b7361f7b1ef2964eb4 (diff) | |
| download | git-efed687edcaa272601e0f4e192db368972daa7ac.tar.xz | |
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 'tree-walk.h')
| -rw-r--r-- | tree-walk.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tree-walk.h b/tree-walk.h index 74cdceb3fe..cf54d01019 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -26,6 +26,7 @@ struct name_entry { * A semi-opaque data structure used to maintain the current state of the walk. */ struct tree_desc { + const struct git_hash_algo *algo; /* * pointer into the memory representation of the tree. It always * points at the current entry being visited. @@ -85,9 +86,11 @@ int update_tree_entry_gently(struct tree_desc *); * size parameters are assumed to be the same as the buffer and size * members of `struct tree`. */ -void init_tree_desc(struct tree_desc *desc, const void *buf, unsigned long size); +void init_tree_desc(struct tree_desc *desc, const struct object_id *tree_oid, + const void *buf, unsigned long size); -int init_tree_desc_gently(struct tree_desc *desc, const void *buf, unsigned long size, +int init_tree_desc_gently(struct tree_desc *desc, const struct object_id *oid, + const void *buf, unsigned long size, enum tree_desc_flags flags); /* |
