path: root/builtin/fsck.c
diff options
authorbrian m. carlson <>2015-11-10 02:22:27 (GMT)
committerJeff King <>2015-11-20 13:02:05 (GMT)
commit7999b2cf772956466baa8925491d6fb1b0963292 (patch)
tree34a3bf75c3cdc621d732107f53181ff28c0550a4 /builtin/fsck.c
parent3c4270107fec2c1d85b7b1a6f8b0aeebf3193b28 (diff)
Add several uses of get_object_hash.
Convert most instances where the sha1 member of struct object is dereferenced to use get_object_hash. Most instances that are passed to functions that have versions taking struct object_id, such as get_sha1_hex/get_oid_hex, or instances that can be trivially converted to use struct object_id instead, are not converted. Signed-off-by: brian m. carlson <> Signed-off-by: Jeff King <>
Diffstat (limited to 'builtin/fsck.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 8b8bb42..4020669 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -186,7 +186,7 @@ static void check_reachable_object(struct object *obj)
* do a full fsck
if (!(obj->flags & HAS_OBJ)) {
- if (has_sha1_pack(obj->sha1))
+ if (has_sha1_pack(get_object_hash(*obj)))
return; /* it is in pack - forget about it */
if (connectivity_only && has_sha1_file(obj->sha1))
@@ -249,7 +249,7 @@ static void check_unreachable_object(struct object *obj)
if (!(f = fopen(filename, "w")))
die_errno("Could not open '%s'", filename);
if (obj->type == OBJ_BLOB) {
- if (stream_blob_to_fd(fileno(f), obj->sha1, NULL, 1))
+ if (stream_blob_to_fd(fileno(f), get_object_hash(*obj), NULL, 1))
die_errno("Could not write '%s'", filename);
} else
fprintf(f, "%s\n", sha1_to_hex(obj->sha1));