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>
This commit is contained in:
brian m. carlson
2015-11-10 02:22:27 +00:00
committed by Jeff King
parent 3c4270107f
commit 7999b2cf77
61 changed files with 253 additions and 253 deletions

View File

@ -251,7 +251,7 @@ static void start_fetch_loose(struct transfer_request *request)
struct active_request_slot *slot;
struct http_object_request *obj_req;
obj_req = new_http_object_request(repo->url, request->obj->sha1);
obj_req = new_http_object_request(repo->url, get_object_hash(*request->obj));
if (obj_req == NULL) {
request->state = ABORTED;
return;
@ -304,7 +304,7 @@ static void start_fetch_packed(struct transfer_request *request)
struct transfer_request *check_request = request_queue_head;
struct http_pack_request *preq;
target = find_sha1_pack(request->obj->sha1, repo->packs);
target = find_sha1_pack(get_object_hash(*request->obj), repo->packs);
if (!target) {
fprintf(stderr, "Unable to fetch %s, will not be able to update server info refs\n", sha1_to_hex(request->obj->sha1));
repo->can_update_info_refs = 0;
@ -361,7 +361,7 @@ static void start_put(struct transfer_request *request)
ssize_t size;
git_zstream stream;
unpacked = read_sha1_file(request->obj->sha1, &type, &len);
unpacked = read_sha1_file(get_object_hash(*request->obj), &type, &len);
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
/* Set it up */
@ -533,7 +533,7 @@ static void finish_request(struct transfer_request *request)
if (request->state == RUN_MKCOL) {
if (request->curl_result == CURLE_OK ||
request->http_code == 405) {
remote_dir_exists[request->obj->sha1[0]] = 1;
remote_dir_exists[get_object_hash(*request->obj)[0]] = 1;
start_put(request);
} else {
fprintf(stderr, "MKCOL %s failed, aborting (%d/%ld)\n",
@ -614,7 +614,7 @@ static int fill_active_slot(void *unused)
start_fetch_loose(request);
return 1;
} else if (pushing && request->state == NEED_PUSH) {
if (remote_dir_exists[request->obj->sha1[0]] == 1) {
if (remote_dir_exists[get_object_hash(*request->obj)[0]] == 1) {
start_put(request);
} else {
start_mkcol(request);
@ -638,8 +638,8 @@ static void add_fetch_request(struct object *obj)
* Don't fetch the object if it's known to exist locally
* or is already in the request queue
*/
if (remote_dir_exists[obj->sha1[0]] == -1)
get_remote_object_list(obj->sha1[0]);
if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
get_remote_object_list(get_object_hash(*obj)[0]);
if (obj->flags & (LOCAL | FETCHING))
return;
@ -671,11 +671,11 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
* Don't push the object if it's known to exist on the remote
* or is already in the request queue
*/
if (remote_dir_exists[obj->sha1[0]] == -1)
get_remote_object_list(obj->sha1[0]);
if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
get_remote_object_list(get_object_hash(*obj)[0]);
if (obj->flags & (REMOTE | PUSHING))
return 0;
target = find_sha1_pack(obj->sha1, repo->packs);
target = find_sha1_pack(get_object_hash(*obj), repo->packs);
if (target) {
obj->flags |= REMOTE;
return 0;