Convert remaining callers of lookup_commit_reference* to object_id

There are a small number of remaining callers of lookup_commit_reference
and lookup_commit_reference_gently that still need to be converted to
struct object_id.  Convert these.

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-05-06 22:10:09 +00:00
committed by Junio C Hamano
parent 7422ab50d1
commit 1e43ed9867
6 changed files with 39 additions and 39 deletions

View File

@ -535,7 +535,7 @@ int notes_merge(struct notes_merge_options *o,
struct notes_tree *local_tree,
unsigned char *result_sha1)
{
unsigned char local_sha1[20], remote_sha1[20];
struct object_id local_oid, remote_oid;
struct commit *local, *remote;
struct commit_list *bases = NULL;
const unsigned char *base_sha1, *base_tree_sha1;
@ -549,46 +549,46 @@ int notes_merge(struct notes_merge_options *o,
o->local_ref, o->remote_ref);
/* Dereference o->local_ref into local_sha1 */
if (read_ref_full(o->local_ref, 0, local_sha1, NULL))
if (read_ref_full(o->local_ref, 0, local_oid.hash, NULL))
die("Failed to resolve local notes ref '%s'", o->local_ref);
else if (!check_refname_format(o->local_ref, 0) &&
is_null_sha1(local_sha1))
is_null_oid(&local_oid))
local = NULL; /* local_sha1 == null_sha1 indicates unborn ref */
else if (!(local = lookup_commit_reference(local_sha1)))
else if (!(local = lookup_commit_reference(local_oid.hash)))
die("Could not parse local commit %s (%s)",
sha1_to_hex(local_sha1), o->local_ref);
trace_printf("\tlocal commit: %.7s\n", sha1_to_hex(local_sha1));
oid_to_hex(&local_oid), o->local_ref);
trace_printf("\tlocal commit: %.7s\n", oid_to_hex(&local_oid));
/* Dereference o->remote_ref into remote_sha1 */
if (get_sha1(o->remote_ref, remote_sha1)) {
if (get_oid(o->remote_ref, &remote_oid)) {
/*
* Failed to get remote_sha1. If o->remote_ref looks like an
* unborn ref, perform the merge using an empty notes tree.
*/
if (!check_refname_format(o->remote_ref, 0)) {
hashclr(remote_sha1);
oidclr(&remote_oid);
remote = NULL;
} else {
die("Failed to resolve remote notes ref '%s'",
o->remote_ref);
}
} else if (!(remote = lookup_commit_reference(remote_sha1))) {
} else if (!(remote = lookup_commit_reference(remote_oid.hash))) {
die("Could not parse remote commit %s (%s)",
sha1_to_hex(remote_sha1), o->remote_ref);
oid_to_hex(&remote_oid), o->remote_ref);
}
trace_printf("\tremote commit: %.7s\n", sha1_to_hex(remote_sha1));
trace_printf("\tremote commit: %.7s\n", oid_to_hex(&remote_oid));
if (!local && !remote)
die("Cannot merge empty notes ref (%s) into empty notes ref "
"(%s)", o->remote_ref, o->local_ref);
if (!local) {
/* result == remote commit */
hashcpy(result_sha1, remote_sha1);
hashcpy(result_sha1, remote_oid.hash);
goto found_result;
}
if (!remote) {
/* result == local commit */
hashcpy(result_sha1, local_sha1);
hashcpy(result_sha1, local_oid.hash);
goto found_result;
}
assert(local && remote);