summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-02-21 23:47:35 +0000
committerJunio C Hamano <gitster@pobox.com>2017-02-22 10:12:15 -0800
commit76c1d9a09624ae39fa9e3140f6581e672b9c040a (patch)
treeb146b591ad3123bcb93f66787e216c4bfd630e1e /sha1_file.c
parent068f85e31311f521adffbcbf96f6583206d77b7d (diff)
downloadgit-76c1d9a09624ae39fa9e3140f6581e672b9c040a.tar.gz
Convert object iteration callbacks to struct object_id
Convert each_loose_object_fn and each_packed_object_fn to take a pointer to struct object_id. Update the various callbacks. Convert several 40-based constants to use GIT_SHA1_HEXSZ. 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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 777b8e8eae..6b74c7d3bc 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3685,15 +3685,15 @@ static int for_each_file_in_obj_subdir(int subdir_nr,
strbuf_setlen(path, baselen);
strbuf_addf(path, "/%s", de->d_name);
- if (strlen(de->d_name) == 38) {
- char hex[41];
- unsigned char sha1[20];
+ if (strlen(de->d_name) == GIT_SHA1_HEXSZ - 2) {
+ char hex[GIT_SHA1_HEXSZ+1];
+ struct object_id oid;
snprintf(hex, sizeof(hex), "%02x%s",
subdir_nr, de->d_name);
- if (!get_sha1_hex(hex, sha1)) {
+ if (!get_oid_hex(hex, &oid)) {
if (obj_cb) {
- r = obj_cb(sha1, path->buf, data);
+ r = obj_cb(&oid, path->buf, data);
if (r)
break;
}
@@ -3805,7 +3805,7 @@ static int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn c
return error("unable to get sha1 of object %u in %s",
i, p->pack_name);
- r = cb(oid.hash, p, i, data);
+ r = cb(&oid, p, i, data);
if (r)
break;
}