summaryrefslogtreecommitdiff
path: root/tree-walk.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-03-12 02:27:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 16:23:50 (GMT)
commit0d4a8b5b6ce4db0846b3545a753f0e698db3eda9 (patch)
treee6979cb6fa14d88673272567534f104e73fdfec4 /tree-walk.c
parente8adba25ff74f2cb95f480a86063190c0fb57ec2 (diff)
downloadgit-0d4a8b5b6ce4db0846b3545a753f0e698db3eda9.zip
git-0d4a8b5b6ce4db0846b3545a753f0e698db3eda9.tar.gz
git-0d4a8b5b6ce4db0846b3545a753f0e698db3eda9.tar.bz2
tree-walk: convert get_tree_entry_follow_symlinks internals to object_id
Convert the internals of this function to use struct object_id. This is one of the last remaining callers of read_sha1_file_extended that has not been converted yet. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tree-walk.c b/tree-walk.c
index 63a87ed..521defd 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -583,14 +583,14 @@ enum follow_symlinks_result get_tree_entry_follow_symlinks(unsigned char *tree_s
struct dir_state *parents = NULL;
size_t parents_alloc = 0;
size_t i, parents_nr = 0;
- unsigned char current_tree_sha1[20];
+ struct object_id current_tree_oid;
struct strbuf namebuf = STRBUF_INIT;
struct tree_desc t;
int follows_remaining = GET_TREE_ENTRY_FOLLOW_SYMLINKS_MAX_LINKS;
init_tree_desc(&t, NULL, 0UL);
strbuf_addstr(&namebuf, name);
- hashcpy(current_tree_sha1, tree_sha1);
+ hashcpy(current_tree_oid.hash, tree_sha1);
while (1) {
int find_result;
@@ -599,22 +599,22 @@ enum follow_symlinks_result get_tree_entry_follow_symlinks(unsigned char *tree_s
if (!t.buffer) {
void *tree;
- unsigned char root[20];
+ struct object_id root;
unsigned long size;
- tree = read_object_with_reference(current_tree_sha1,
+ tree = read_object_with_reference(current_tree_oid.hash,
tree_type, &size,
- root);
+ root.hash);
if (!tree)
goto done;
ALLOC_GROW(parents, parents_nr + 1, parents_alloc);
parents[parents_nr].tree = tree;
parents[parents_nr].size = size;
- hashcpy(parents[parents_nr].sha1, root);
+ hashcpy(parents[parents_nr].sha1, root.hash);
parents_nr++;
if (namebuf.buf[0] == '\0') {
- hashcpy(result, root);
+ hashcpy(result, root.hash);
retval = FOUND;
goto done;
}
@@ -671,14 +671,14 @@ enum follow_symlinks_result get_tree_entry_follow_symlinks(unsigned char *tree_s
/* Look up the first (or only) path component in the tree. */
find_result = find_tree_entry(&t, namebuf.buf,
- current_tree_sha1, mode);
+ current_tree_oid.hash, mode);
if (find_result) {
goto done;
}
if (S_ISDIR(*mode)) {
if (!remainder) {
- hashcpy(result, current_tree_sha1);
+ hashcpy(result, current_tree_oid.hash);
retval = FOUND;
goto done;
}
@@ -688,7 +688,7 @@ enum follow_symlinks_result get_tree_entry_follow_symlinks(unsigned char *tree_s
1 + first_slash - namebuf.buf);
} else if (S_ISREG(*mode)) {
if (!remainder) {
- hashcpy(result, current_tree_sha1);
+ hashcpy(result, current_tree_oid.hash);
retval = FOUND;
} else {
retval = NOT_DIR;
@@ -714,7 +714,7 @@ enum follow_symlinks_result get_tree_entry_follow_symlinks(unsigned char *tree_s
*/
retval = DANGLING_SYMLINK;
- contents = read_sha1_file(current_tree_sha1, &type,
+ contents = read_sha1_file(current_tree_oid.hash, &type,
&link_len);
if (!contents)