summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-03-12 02:27:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 16:23:48 (GMT)
commitd61d87bd156a1d49b827d1b26f023fd70febfa06 (patch)
treedc70591686c1769f5146b0e0822aec366a1b8dfc /sha1_file.c
parentaf8caf33d5ac055addff3971747898799c21557c (diff)
downloadgit-d61d87bd156a1d49b827d1b26f023fd70febfa06.zip
git-d61d87bd156a1d49b827d1b26f023fd70febfa06.tar.gz
git-d61d87bd156a1d49b827d1b26f023fd70febfa06.tar.bz2
sha1_file: convert read_loose_object to use struct object_id
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 6b887f8..5081d58 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2176,7 +2176,7 @@ static int check_stream_sha1(git_zstream *stream,
}
int read_loose_object(const char *path,
- const unsigned char *expected_sha1,
+ const struct object_id *expected_oid,
enum object_type *type,
unsigned long *size,
void **contents)
@@ -2208,19 +2208,19 @@ int read_loose_object(const char *path,
}
if (*type == OBJ_BLOB) {
- if (check_stream_sha1(&stream, hdr, *size, path, expected_sha1) < 0)
+ if (check_stream_sha1(&stream, hdr, *size, path, expected_oid->hash) < 0)
goto out;
} else {
- *contents = unpack_sha1_rest(&stream, hdr, *size, expected_sha1);
+ *contents = unpack_sha1_rest(&stream, hdr, *size, expected_oid->hash);
if (!*contents) {
error("unable to unpack contents of %s", path);
git_inflate_end(&stream);
goto out;
}
- if (check_sha1_signature(expected_sha1, *contents,
+ if (check_sha1_signature(expected_oid->hash, *contents,
*size, type_name(*type))) {
error("sha1 mismatch for %s (expected %s)", path,
- sha1_to_hex(expected_sha1));
+ oid_to_hex(expected_oid));
free(*contents);
goto out;
}