summaryrefslogtreecommitdiff
path: root/list-objects.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2019-01-15 00:39:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-15 17:57:41 (GMT)
commitea82b2a0857e3e0449bdce4e3987dee6adbc51ae (patch)
treeed064565c3b49c8636c36dd9ce2f5ef108066f0b /list-objects.c
parentf55ac4311ad173529cbac7a619d422674a4252ad (diff)
downloadgit-ea82b2a0857e3e0449bdce4e3987dee6adbc51ae.zip
git-ea82b2a0857e3e0449bdce4e3987dee6adbc51ae.tar.gz
git-ea82b2a0857e3e0449bdce4e3987dee6adbc51ae.tar.bz2
tree-walk: store object_id in a separate member
When parsing a tree, we read the object ID directly out of the tree buffer. This is normally fine, but such an object ID cannot be used with oidcpy, which copies GIT_MAX_RAWSZ bytes, because if we are using SHA-1, there may not be that many bytes to copy. Instead, store the object ID in a separate struct member. Since we can no longer efficiently compute the path length, store that information as well in struct name_entry. Ensure we only copy the object ID into the new buffer if the path length is nonzero, as some callers will pass us an empty path with no object ID following it, and we will not want to read past the end of the buffer. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/list-objects.c b/list-objects.c
index cf7f25b..ee6aff0 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -123,15 +123,15 @@ static void process_tree_contents(struct traversal_context *ctx,
}
if (S_ISDIR(entry.mode)) {
- struct tree *t = lookup_tree(ctx->revs->repo, entry.oid);
+ struct tree *t = lookup_tree(ctx->revs->repo, &entry.oid);
t->object.flags |= NOT_USER_GIVEN;
process_tree(ctx, t, base, entry.path);
}
else if (S_ISGITLINK(entry.mode))
- process_gitlink(ctx, entry.oid->hash,
+ process_gitlink(ctx, entry.oid.hash,
base, entry.path);
else {
- struct blob *b = lookup_blob(ctx->revs->repo, entry.oid);
+ struct blob *b = lookup_blob(ctx->revs->repo, &entry.oid);
b->object.flags |= NOT_USER_GIVEN;
process_blob(ctx, b, base, entry.path);
}