From f4e54d02b894064d370e461385b48701485672bd Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Tue, 10 Nov 2015 02:22:20 +0000 Subject: Convert struct ref to use object_id. Use struct object_id in three fields in struct ref and convert all the necessary places that use it. Signed-off-by: brian m. carlson Signed-off-by: Jeff King --- transport-helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'transport-helper.c') diff --git a/transport-helper.c b/transport-helper.c index 63d54271b..91cb0e72c 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -346,7 +346,7 @@ static int fetch_with_fetch(struct transport *transport, continue; strbuf_addf(&buf, "fetch %s %s\n", - sha1_to_hex(posn->old_sha1), + oid_to_hex(&posn->old_oid), posn->symref ? posn->symref : posn->name); } @@ -489,7 +489,7 @@ static int fetch_with_import(struct transport *transport, else private = xstrdup(name); if (private) { - if (read_ref(private, posn->old_sha1) < 0) + if (read_ref(private, posn->old_oid.hash) < 0) die("Could not read ref %s", private); free(private); } @@ -756,7 +756,7 @@ static int push_update_refs_status(struct helper_data *data, private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name); if (!private) continue; - update_ref("update by helper", private, ref->new_sha1, NULL, 0, 0); + update_ref("update by helper", private, ref->new_oid.hash, NULL, 0, 0); free(private); } strbuf_release(&buf); @@ -818,7 +818,7 @@ static int push_refs_with_push(struct transport *transport, if (ref->peer_ref) strbuf_addstr(&buf, ref->peer_ref->name); else - strbuf_addstr(&buf, sha1_to_hex(ref->new_sha1)); + strbuf_addstr(&buf, oid_to_hex(&ref->new_oid)); } strbuf_addch(&buf, ':'); strbuf_addstr(&buf, ref->name); @@ -827,14 +827,14 @@ static int push_refs_with_push(struct transport *transport, /* * The "--force-with-lease" options without explicit * values to expect have already been expanded into - * the ref->old_sha1_expect[] field; we can ignore + * the ref->old_oid_expect[] field; we can ignore * transport->smart_options->cas altogether and instead * can enumerate them from the refs. */ if (ref->expect_old_sha1) { struct strbuf cas = STRBUF_INIT; strbuf_addf(&cas, "%s:%s", - ref->name, sha1_to_hex(ref->old_sha1_expect)); + ref->name, oid_to_hex(&ref->old_oid_expect)); string_list_append(&cas_options, strbuf_detach(&cas, NULL)); } } @@ -884,7 +884,7 @@ static int push_refs_with_export(struct transport *transport, if (private && !get_sha1(private, sha1)) { strbuf_addf(&buf, "^%s", private); string_list_append(&revlist_args, strbuf_detach(&buf, NULL)); - hashcpy(ref->old_sha1, sha1); + hashcpy(ref->old_oid.hash, sha1); } free(private); @@ -1016,12 +1016,12 @@ static struct ref *get_refs_list(struct transport *transport, int for_push) if (buf.buf[0] == '@') (*tail)->symref = xstrdup(buf.buf + 1); else if (buf.buf[0] != '?') - get_sha1_hex(buf.buf, (*tail)->old_sha1); + get_oid_hex(buf.buf, &(*tail)->old_oid); if (eon) { if (has_attribute(eon + 1, "unchanged")) { (*tail)->status |= REF_STATUS_UPTODATE; if (read_ref((*tail)->name, - (*tail)->old_sha1) < 0) + (*tail)->old_oid.hash) < 0) die(N_("Could not read ref %s"), (*tail)->name); } -- cgit v1.2.1