Convert sha1_array_for_each_unique and for_each_abbrev to object_id

Make sha1_array_for_each_unique take a callback using struct object_id.
Since one of these callbacks is an argument to for_each_abbrev, convert
those as well.  Rename various functions, replacing "sha1" with "oid".

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2017-03-31 01:39:59 +00:00
committed by Junio C Hamano
parent 5d3206d501
commit 1b7ba794d2
9 changed files with 35 additions and 37 deletions

View File

@ -225,10 +225,10 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
return git_default_config(var, value, cb);
}
static void show_ref(const char *path, const unsigned char *sha1)
static void show_ref(const char *path, const struct object_id *oid)
{
if (sent_capabilities) {
packet_write_fmt(1, "%s %s\n", sha1_to_hex(sha1), path);
packet_write_fmt(1, "%s %s\n", oid_to_hex(oid), path);
} else {
struct strbuf cap = STRBUF_INIT;
@ -244,7 +244,7 @@ static void show_ref(const char *path, const unsigned char *sha1)
strbuf_addstr(&cap, " push-options");
strbuf_addf(&cap, " agent=%s", git_user_agent_sanitized());
packet_write_fmt(1, "%s %s%c%s\n",
sha1_to_hex(sha1), path, 0, cap.buf);
oid_to_hex(oid), path, 0, cap.buf);
strbuf_release(&cap);
sent_capabilities = 1;
}
@ -271,7 +271,7 @@ static int show_ref_cb(const char *path_full, const struct object_id *oid,
} else {
oidset_insert(seen, oid);
}
show_ref(path, oid->hash);
show_ref(path, oid);
return 0;
}
@ -284,7 +284,7 @@ static void show_one_alternate_ref(const char *refname,
if (oidset_insert(seen, oid))
return;
show_ref(".have", oid->hash);
show_ref(".have", oid);
}
static void write_head_info(void)
@ -295,7 +295,7 @@ static void write_head_info(void)
for_each_alternate_ref(show_one_alternate_ref, &seen);
oidset_clear(&seen);
if (!sent_capabilities)
show_ref("capabilities^{}", null_sha1);
show_ref("capabilities^{}", &null_oid);
advertise_shallow_grafts(1);