http-push: remove remaining uses of sha1_to_hex
Since sha1_to_hex is limited to SHA-1, switch all remaining uses of it in this file to hash_to_hex or oid_to_hex. Modify update_remote to take a pointer to struct object_id, and since we don't modify that parameter in the function, set it to be const as well. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Feb 19, 2019 at 00:05 UTC
1cb158b6e65fbfd12099dc0d39642ad146dd887f
1 file changed
+4
-4
http-push.c
+4
-4
@@ -316,7 +316,7 @@ static void start_fetch_packed(struct transfer_request *request)
316
}
317
318
fprintf(stderr, "Fetching pack %s\n",
319
- sha1_to_hex(target->hash));
319
+ hash_to_hex(target->hash));
320
fprintf(stderr, " which contains %s\n", oid_to_hex(&request->obj->oid));
321
322
preq = new_http_pack_request(target, repo->url);
@@ -1374,7 +1374,7 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock)
1374
return count;
1375
}
1376
1377
-static int update_remote(unsigned char *sha1, struct remote_lock *lock)
1377
+static int update_remote(const struct object_id *oid, struct remote_lock *lock)
1378
{
1379
struct active_request_slot *slot;
1380
struct slot_results results;
@@ -1383,7 +1383,7 @@ static int update_remote(unsigned char *sha1, struct remote_lock *lock)
1383
1384
dav_headers = get_dav_token_headers(lock, DAV_HEADER_IF);
1385
1386
- strbuf_addf(&out_buffer.buf, "%s\n", sha1_to_hex(sha1));
1386
+ strbuf_addf(&out_buffer.buf, "%s\n", oid_to_hex(oid));
1387
1388
slot = get_active_slot();
1389
slot->results = &results;
@@ -1948,7 +1948,7 @@ int cmd_main(int argc, const char **argv)
1948
run_request_queue();
1949
1950
/* Update the remote branch if all went well */
1951
- if (aborted || !update_remote(ref->new_oid.hash, ref_lock))
1951
+ if (aborted || !update_remote(&ref->new_oid, ref_lock))
1952
rc = 1;
1953
1954
if (!rc)