From: brian m. carlson Date: Sat, 6 May 2017 22:10:07 +0000 (+0000) Subject: sequencer: convert some functions to struct object_id X-Git-Tag: v2.14.0-rc0~166^2~31 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/33d66df34ece4f597590263df502ff3578b6becd sequencer: convert some functions to struct object_id Convert update_squash_messages and is_index_unchanged to struct object_id. These are callers of lookup_commit and lookup_commit_reference, which we want to convert. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- diff --git a/sequencer.c b/sequencer.c index b0f862b7bb..b94830cf9e 100644 --- a/sequencer.c +++ b/sequencer.c @@ -482,13 +482,13 @@ static int do_recursive_merge(struct commit *base, struct commit *next, static int is_index_unchanged(void) { - unsigned char head_sha1[20]; + struct object_id head_oid; struct commit *head_commit; - if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_sha1, NULL)) + if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_oid.hash, NULL)) return error(_("could not resolve HEAD commit\n")); - head_commit = lookup_commit(head_sha1); + head_commit = lookup_commit(head_oid.hash); /* * If head_commit is NULL, check_commit, called from @@ -835,13 +835,13 @@ static int update_squash_messages(enum todo_command command, strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len); strbuf_release(&header); } else { - unsigned char head[20]; + struct object_id head; struct commit *head_commit; const char *head_message, *body; - if (get_sha1("HEAD", head)) + if (get_oid("HEAD", &head)) return error(_("need a HEAD to fixup")); - if (!(head_commit = lookup_commit_reference(head))) + if (!(head_commit = lookup_commit_reference(head.hash))) return error(_("could not read HEAD")); if (!(head_message = get_commit_buffer(head_commit, NULL))) return error(_("could not read HEAD's commit message"));