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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 6, 2017 at 22:10 UTC
33d66df34ece4f597590263df502ff3578b6becd
1 file changed
+6
-6
sequencer.c
+6
-6
@@ -482,13 +482,13 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
482
483
static int is_index_unchanged(void)
484
{
485
- unsigned char head_sha1[20];
485
+ struct object_id head_oid;
486
struct commit *head_commit;
487
488
- if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_sha1, NULL))
488
+ if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_oid.hash, NULL))
489
return error(_("could not resolve HEAD commit\n"));
490
491
- head_commit = lookup_commit(head_sha1);
491
+ head_commit = lookup_commit(head_oid.hash);
492
493
/*
494
* If head_commit is NULL, check_commit, called from
@@ -835,13 +835,13 @@ static int update_squash_messages(enum todo_command command,
835
strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len);
836
strbuf_release(&header);
837
} else {
838
- unsigned char head[20];
838
+ struct object_id head;
839
struct commit *head_commit;
840
const char *head_message, *body;
841
842
- if (get_sha1("HEAD", head))
842
+ if (get_oid("HEAD", &head))
843
return error(_("need a HEAD to fixup"));
844
- if (!(head_commit = lookup_commit_reference(head)))
844
+ if (!(head_commit = lookup_commit_reference(head.hash)))
845
return error(_("could not read HEAD"));
846
if (!(head_message = get_commit_buffer(head_commit, NULL)))
847
return error(_("could not read HEAD's commit message"));