]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/rebase.c
rebase: be stricter when reading state files containing oids
[thirdparty/git.git] / builtin / rebase.c
index 70aa7c842f34b2a8cfbdf2c33d3b699bbda0404c..4139562cdb38a491eb8136c122bd08acb418961e 100644 (file)
@@ -429,9 +429,9 @@ static int read_basic_state(struct rebase_options *opts)
        opts->head_name = starts_with(head_name.buf, "refs/") ?
                xstrdup(head_name.buf) : NULL;
        strbuf_release(&head_name);
-       if (get_oid(buf.buf, &oid))
-               return error(_("could not get 'onto': '%s'"), buf.buf);
-       opts->onto = lookup_commit_or_die(&oid, buf.buf);
+       if (get_oid_hex(buf.buf, &oid) ||
+           !(opts->onto = lookup_commit_object(the_repository, &oid)))
+               return error(_("invalid onto: '%s'"), buf.buf);
 
        /*
         * We always write to orig-head, but interactive rebase used to write to
@@ -446,7 +446,7 @@ static int read_basic_state(struct rebase_options *opts)
        } else if (!read_oneliner(&buf, state_dir_path("head", opts),
                                  READ_ONELINER_WARN_MISSING))
                return -1;
-       if (get_oid(buf.buf, &opts->orig_head))
+       if (get_oid_hex(buf.buf, &opts->orig_head))
                return error(_("invalid orig-head: '%s'"), buf.buf);
 
        if (file_exists(state_dir_path("quiet", opts)))