diff options
| author | brian m. carlson <sandals@crustytoothpaste.net> | 2015-11-10 02:22:27 +0000 | 
|---|---|---|
| committer | Jeff King <peff@peff.net> | 2015-11-20 08:02:05 -0500 | 
| commit | 7999b2cf772956466baa8925491d6fb1b0963292 (patch) | |
| tree | 34a3bf75c3cdc621d732107f53181ff28c0550a4 /commit.c | |
| parent | 3c4270107fec2c1d85b7b1a6f8b0aeebf3193b28 (diff) | |
| download | git-7999b2cf772956466baa8925491d6fb1b0963292.tar.gz | |
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 <sandals@crustytoothpaste.net>
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'commit.c')
| -rw-r--r-- | commit.c | 12 | 
1 files changed, 6 insertions, 6 deletions
| @@ -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, c->object.sha1)) { +	if (hashcmp(sha1, get_object_hash(c->object))) {  		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(commit->object.sha1, &type, &size); +		ret = read_sha1_file(get_object_hash(commit->object), &type, &size);  		if (!ret)  			die("cannot read commit object %s",  			    sha1_to_hex(commit->object.sha1)); @@ -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(item->object.sha1); +	graft = lookup_commit_graft(get_object_hash(item->object));  	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(item->object.sha1, &type, &size); +	buffer = read_sha1_file(get_object_hash(item->object), &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(object->sha1, 1); +		commit = lookup_commit_reference_gently(get_object_hash(*object), 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(desc->obj->sha1, &type, &size); +	buf = read_sha1_file(get_object_hash(*desc->obj), &type, &size);  	if (!buf || type != OBJ_TAG)  		goto free_return;  	len = parse_signature(buf, size); | 
