refs: convert update_ref and refs_update_ref to use struct object_id
Convert update_ref, refs_update_ref, and write_pseudoref to use struct object_id. Update the existing callers as well. Remove update_ref_oid, as it is no longer needed. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2616a5e508
commit
ae077771b0
@ -610,8 +610,8 @@ static void write_followtags(const struct ref *refs, const char *msg)
|
||||
continue;
|
||||
if (!has_object_file(&ref->old_oid))
|
||||
continue;
|
||||
update_ref(msg, ref->name, ref->old_oid.hash,
|
||||
NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
||||
update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -682,23 +682,23 @@ static void update_head(const struct ref *our, const struct ref *remote,
|
||||
if (create_symref("HEAD", our->name, NULL) < 0)
|
||||
die(_("unable to update HEAD"));
|
||||
if (!option_bare) {
|
||||
update_ref(msg, "HEAD", our->old_oid.hash, NULL, 0,
|
||||
update_ref(msg, "HEAD", &our->old_oid, NULL, 0,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
install_branch_config(0, head, option_origin, our->name);
|
||||
}
|
||||
} else if (our) {
|
||||
struct commit *c = lookup_commit_reference(&our->old_oid);
|
||||
/* --branch specifies a non-branch (i.e. tags), detach HEAD */
|
||||
update_ref(msg, "HEAD", c->object.oid.hash,
|
||||
NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||
update_ref(msg, "HEAD", &c->object.oid, NULL, REF_NODEREF,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
} else if (remote) {
|
||||
/*
|
||||
* We know remote HEAD points to a non-branch, or
|
||||
* HEAD points to a branch but we don't know which one.
|
||||
* Detach HEAD in all these cases.
|
||||
*/
|
||||
update_ref(msg, "HEAD", remote->old_oid.hash,
|
||||
NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||
update_ref(msg, "HEAD", &remote->old_oid, NULL, REF_NODEREF,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user