sequencer: convert some functions to struct object_id
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 6 May 2017 22:10:07 +0000 (22:10 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 May 2017 06:12:57 +0000 (15:12 +0900)
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>
sequencer.c
index b0f862b7bbe5ed21b5f2d549b7b3901bfac92964..b94830cf9e2b86e7a46fa638e1af11cf94ee729c 100644 (file)
@@ -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"));