rebase -i: use struct object_id rather than looking up commit
We already have a struct object_id containing the oid that we want to set ORIG_HEAD to so use that rather than converting it to a string and then calling get_oid() on that string. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e100bea481
commit
f3e27a02d5
@ -370,8 +370,9 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
|
|||||||
|
|
||||||
split_exec_commands(opts->cmd, &commands);
|
split_exec_commands(opts->cmd, &commands);
|
||||||
ret = complete_action(the_repository, &replay, flags,
|
ret = complete_action(the_repository, &replay, flags,
|
||||||
shortrevisions, opts->onto_name, opts->onto, head_hash,
|
shortrevisions, opts->onto_name, opts->onto,
|
||||||
&commands, opts->autosquash, &todo_list);
|
&opts->orig_head, &commands, opts->autosquash,
|
||||||
|
&todo_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
string_list_clear(&commands, 0);
|
string_list_clear(&commands, 0);
|
||||||
|
10
sequencer.c
10
sequencer.c
@ -3965,21 +3965,17 @@ static int run_git_checkout(struct repository *r, struct replay_opts *opts,
|
|||||||
|
|
||||||
static int checkout_onto(struct repository *r, struct replay_opts *opts,
|
static int checkout_onto(struct repository *r, struct replay_opts *opts,
|
||||||
const char *onto_name, const struct object_id *onto,
|
const char *onto_name, const struct object_id *onto,
|
||||||
const char *orig_head)
|
const struct object_id *orig_head)
|
||||||
{
|
{
|
||||||
struct object_id oid;
|
|
||||||
const char *action = reflog_message(opts, "start", "checkout %s", onto_name);
|
const char *action = reflog_message(opts, "start", "checkout %s", onto_name);
|
||||||
|
|
||||||
if (get_oid(orig_head, &oid))
|
|
||||||
return error(_("%s: not a valid OID"), orig_head);
|
|
||||||
|
|
||||||
if (run_git_checkout(r, opts, oid_to_hex(onto), action)) {
|
if (run_git_checkout(r, opts, oid_to_hex(onto), action)) {
|
||||||
apply_autostash(rebase_path_autostash());
|
apply_autostash(rebase_path_autostash());
|
||||||
sequencer_remove_state(opts);
|
sequencer_remove_state(opts);
|
||||||
return error(_("could not detach HEAD"));
|
return error(_("could not detach HEAD"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return update_ref(NULL, "ORIG_HEAD", &oid, NULL, 0, UPDATE_REFS_MSG_ON_ERR);
|
return update_ref(NULL, "ORIG_HEAD", orig_head, NULL, 0, UPDATE_REFS_MSG_ON_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stopped_at_head(struct repository *r)
|
static int stopped_at_head(struct repository *r)
|
||||||
@ -5314,7 +5310,7 @@ static int skip_unnecessary_picks(struct repository *r,
|
|||||||
|
|
||||||
int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
|
int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
|
||||||
const char *shortrevisions, const char *onto_name,
|
const char *shortrevisions, const char *onto_name,
|
||||||
struct commit *onto, const char *orig_head,
|
struct commit *onto, const struct object_id *orig_head,
|
||||||
struct string_list *commands, unsigned autosquash,
|
struct string_list *commands, unsigned autosquash,
|
||||||
struct todo_list *todo_list)
|
struct todo_list *todo_list)
|
||||||
{
|
{
|
||||||
|
@ -163,8 +163,9 @@ void todo_list_add_exec_commands(struct todo_list *todo_list,
|
|||||||
struct string_list *commands);
|
struct string_list *commands);
|
||||||
int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
|
int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
|
||||||
const char *shortrevisions, const char *onto_name,
|
const char *shortrevisions, const char *onto_name,
|
||||||
struct commit *onto, const char *orig_head, struct string_list *commands,
|
struct commit *onto, const struct object_id *orig_head,
|
||||||
unsigned autosquash, struct todo_list *todo_list);
|
struct string_list *commands, unsigned autosquash,
|
||||||
|
struct todo_list *todo_list);
|
||||||
int todo_list_rearrange_squash(struct todo_list *todo_list);
|
int todo_list_rearrange_squash(struct todo_list *todo_list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user