summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-05-06 22:10:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-08 06:12:57 (GMT)
commit740ee055c6178fc2dd43c5ccfbd367c4c64d6e0d (patch)
treee0ce96e53ce7957480f693147ea9693a33c6a211 /tree.c
parent49a09e74a413cfccee2c249407b46cdd0ea699cd (diff)
downloadgit-740ee055c6178fc2dd43c5ccfbd367c4c64d6e0d.zip
git-740ee055c6178fc2dd43c5ccfbd367c4c64d6e0d.tar.gz
git-740ee055c6178fc2dd43c5ccfbd367c4c64d6e0d.tar.bz2
Convert lookup_tree to struct object_id
Convert the lookup_tree function to take a pointer to struct object_id. The commit was created with manual changes to tree.c, tree.h, and object.c, plus the following semantic patch: @@ @@ - lookup_tree(EMPTY_TREE_SHA1_BIN) + lookup_tree(&empty_tree_oid) @@ expression E1; @@ - lookup_tree(E1.hash) + lookup_tree(&E1) @@ expression E1; @@ - lookup_tree(E1->hash) + lookup_tree(E1) Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tree.c b/tree.c
index 21fd80b..28ce930 100644
--- a/tree.c
+++ b/tree.c
@@ -110,7 +110,7 @@ static int read_tree_1(struct tree *tree, struct strbuf *base,
len = tree_entry_len(&entry);
strbuf_add(base, entry.path, len);
strbuf_addch(base, '/');
- retval = read_tree_1(lookup_tree(oid.hash),
+ retval = read_tree_1(lookup_tree(&oid),
base, stage, pathspec,
fn, context);
strbuf_setlen(base, oldlen);
@@ -184,11 +184,11 @@ int read_tree(struct tree *tree, int stage, struct pathspec *match)
return 0;
}
-struct tree *lookup_tree(const unsigned char *sha1)
+struct tree *lookup_tree(const struct object_id *oid)
{
- struct object *obj = lookup_object(sha1);
+ struct object *obj = lookup_object(oid->hash);
if (!obj)
- return create_object(sha1, alloc_tree_node());
+ return create_object(oid->hash, alloc_tree_node());
return object_as_type(obj, OBJ_TREE, 0);
}