diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-11-18 13:32:53 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-11-18 13:32:53 -0800 |
commit | c042c455d4ffb9b5ed0c280301b5661f3efad572 (patch) | |
tree | 11492f3ec3a0b024210d1daed8d0ed868408adf8 /sequencer.c | |
parent | Merge branch 'rs/archive-high-compression' (diff) | |
parent | rebase -i: simplify get_revision_ranges() (diff) | |
download | tgif-c042c455d4ffb9b5ed0c280301b5661f3efad572.tar.xz |
Merge branch 'pw/rebase-i-orig-head'
"git rebase -i" did not store ORIG_HEAD correctly.
* pw/rebase-i-orig-head:
rebase -i: simplify get_revision_ranges()
rebase -i: use struct object_id when writing state
rebase -i: use struct object_id rather than looking up commit
rebase -i: stop overwriting ORIG_HEAD buffer
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sequencer.c b/sequencer.c index 684ea9d5ce..3dce6c963c 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2690,7 +2690,7 @@ static void write_strategy_opts(struct replay_opts *opts) } int write_basic_state(struct replay_opts *opts, const char *head_name, - struct commit *onto, const char *orig_head) + struct commit *onto, const struct object_id *orig_head) { if (head_name) write_file(rebase_path_head_name(), "%s\n", head_name); @@ -2698,7 +2698,8 @@ int write_basic_state(struct replay_opts *opts, const char *head_name, write_file(rebase_path_onto(), "%s\n", oid_to_hex(&onto->object.oid)); if (orig_head) - write_file(rebase_path_orig_head(), "%s\n", orig_head); + write_file(rebase_path_orig_head(), "%s\n", + oid_to_hex(orig_head)); if (opts->quiet) write_file(rebase_path_quiet(), "%s", ""); @@ -3964,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, 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); - 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)) { apply_autostash(rebase_path_autostash()); sequencer_remove_state(opts); 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) @@ -5294,7 +5291,7 @@ static int skip_unnecessary_picks(struct repository *r, int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags, 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 todo_list *todo_list) { |