Remove get_object_hash.

Convert all instances of get_object_hash to use an appropriate reference
to the hash member of the oid member of struct object.  This provides no
functional change, as it is essentially a macro substitution.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Jeff King <peff@peff.net>
This commit is contained in:
brian m. carlson
2015-11-10 02:22:29 +00:00
committed by Jeff King
parent f2fd0760f6
commit ed1c9977cb
63 changed files with 251 additions and 253 deletions

View File

@ -38,7 +38,7 @@ struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_n
struct commit *c = lookup_commit_reference(sha1);
if (!c)
die(_("could not parse %s"), ref_name);
if (hashcmp(sha1, get_object_hash(c->object))) {
if (hashcmp(sha1, c->object.oid.hash)) {
warning(_("%s %s is not a commit!"),
ref_name, sha1_to_hex(sha1));
}
@ -262,7 +262,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
if (!ret) {
enum object_type type;
unsigned long size;
ret = read_sha1_file(get_object_hash(commit->object), &type, &size);
ret = read_sha1_file(commit->object.oid.hash, &type, &size);
if (!ret)
die("cannot read commit object %s",
oid_to_hex(&commit->object.oid));
@ -335,7 +335,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
pptr = &item->parents;
graft = lookup_commit_graft(get_object_hash(item->object));
graft = lookup_commit_graft(item->object.oid.hash);
while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
struct commit *new_parent;
@ -380,7 +380,7 @@ int parse_commit_gently(struct commit *item, int quiet_on_missing)
return -1;
if (item->object.parsed)
return 0;
buffer = read_sha1_file(get_object_hash(item->object), &type, &size);
buffer = read_sha1_file(item->object.oid.hash, &type, &size);
if (!buffer)
return quiet_on_missing ? -1 :
error("Could not read %s",
@ -563,7 +563,7 @@ void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
for (i = 0; i < a->nr; i++) {
object = a->objects[i].item;
commit = lookup_commit_reference_gently(get_object_hash(*object), 1);
commit = lookup_commit_reference_gently(object->oid.hash, 1);
if (commit)
clear_commit_marks(commit, mark);
}
@ -1206,7 +1206,7 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
desc = merge_remote_util(parent);
if (!desc || !desc->obj)
return;
buf = read_sha1_file(get_object_hash(*desc->obj), &type, &size);
buf = read_sha1_file(desc->obj->oid.hash, &type, &size);
if (!buf || type != OBJ_TAG)
goto free_return;
len = parse_signature(buf, size);