summaryrefslogtreecommitdiff
path: root/notes-merge.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-05-06 22:10:09 +0000
committerJunio C Hamano <gitster@pobox.com>2017-05-08 15:12:57 +0900
commit1e43ed986775d8e8ecaef4dac8b98dcbae6298c1 (patch)
treeff277db9f9c9fbee8f4a87dc7f6cb8ea0c97a332 /notes-merge.c
parent7422ab50d1011b2b26b59bf11b91a1202618f3e5 (diff)
downloadgit-1e43ed986775d8e8ecaef4dac8b98dcbae6298c1.tar.gz
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>
Diffstat (limited to 'notes-merge.c')
-rw-r--r--notes-merge.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/notes-merge.c b/notes-merge.c
index 32caaaff74..06d8be9cbf 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -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);