summaryrefslogtreecommitdiff
path: root/builtin/notes.c
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2017-02-21 23:47:29 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-02-22 10:12:15 -0800
commit2928325fc0b676876fcda5ffcbc461695aaedbb8 (patch)
treebbe6fa6cbfad815394e85025adbd8fda34c9b7cf /builtin/notes.c
parentbuiltin/merge: convert to struct object_id (diff)
downloadtgif-2928325fc0b676876fcda5ffcbc461695aaedbb8.tar.xz
Convert remaining callers of resolve_refdup to object_id
There are a few leaf functions in various files that call resolve_refdup. Convert these functions to use struct object_id internally to prepare for transitioning resolve_refdup itself. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/notes.c')
-rw-r--r--builtin/notes.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index 5248a9bad8..8c569a49a0 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -693,7 +693,7 @@ static int merge_abort(struct notes_merge_options *o)
static int merge_commit(struct notes_merge_options *o)
{
struct strbuf msg = STRBUF_INIT;
- unsigned char sha1[20], parent_sha1[20];
+ struct object_id oid, parent_oid;
struct notes_tree *t;
struct commit *partial;
struct pretty_print_context pretty_ctx;
@@ -705,27 +705,27 @@ static int merge_commit(struct notes_merge_options *o)
* and target notes ref from .git/NOTES_MERGE_REF.
*/
- if (get_sha1("NOTES_MERGE_PARTIAL", sha1))
+ if (get_oid("NOTES_MERGE_PARTIAL", &oid))
die(_("failed to read ref NOTES_MERGE_PARTIAL"));
- else if (!(partial = lookup_commit_reference(sha1)))
+ else if (!(partial = lookup_commit_reference(oid.hash)))
die(_("could not find commit from NOTES_MERGE_PARTIAL."));
else if (parse_commit(partial))
die(_("could not parse commit from NOTES_MERGE_PARTIAL."));
if (partial->parents)
- hashcpy(parent_sha1, partial->parents->item->object.oid.hash);
+ oidcpy(&parent_oid, &partial->parents->item->object.oid);
else
- hashclr(parent_sha1);
+ oidclr(&parent_oid);
t = xcalloc(1, sizeof(struct notes_tree));
init_notes(t, "NOTES_MERGE_PARTIAL", combine_notes_overwrite, 0);
o->local_ref = local_ref_to_free =
- resolve_refdup("NOTES_MERGE_REF", 0, sha1, NULL);
+ resolve_refdup("NOTES_MERGE_REF", 0, oid.hash, NULL);
if (!o->local_ref)
die(_("failed to resolve NOTES_MERGE_REF"));
- if (notes_merge_commit(o, t, partial, sha1))
+ if (notes_merge_commit(o, t, partial, oid.hash))
die(_("failed to finalize notes merge"));
/* Reuse existing commit message in reflog message */
@@ -733,8 +733,8 @@ static int merge_commit(struct notes_merge_options *o)
format_commit_message(partial, "%s", &msg, &pretty_ctx);
strbuf_trim(&msg);
strbuf_insert(&msg, 0, "notes: ", 7);
- update_ref(msg.buf, o->local_ref, sha1,
- is_null_sha1(parent_sha1) ? NULL : parent_sha1,
+ update_ref(msg.buf, o->local_ref, oid.hash,
+ is_null_oid(&parent_oid) ? NULL : parent_oid.hash,
0, UPDATE_REFS_DIE_ON_ERR);
free_notes(t);