rebase: cleanup reset_head() calls

If ORIG_HEAD is not set by passing RESET_ORIG_HEAD then there is no need to pass anything for reflog_orig_head. In addition to the callers fixed in this commit move_to_original_branch() also passes reflog_orig_head without setting ORIG_HEAD. That caller is mistakenly passing the message it wants to put in the branch reflog which is not currently possible so we delay fixing that caller until we can pass the message as the branch reflog. A later commit will make it a BUG() to pass reflog_orig_head without RESET_ORIG_HEAD, that changes cannot be done here as it needs to wait for move_to_original_branch() to be fixed first. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Phillip Wood committed Jan 26, 2022 at 13:05 UTC ee464c4e37c7f34c4e5ba2fce35df4149083e5ea
1 file changed +2 -2
builtin/rebase.c
+2 -2
@@ -675,7 +675,7 @@ static int run_am(struct rebase_options *opts)
675
676 reset_head(the_repository, &opts->orig_head,
677 opts->head_name, 0,
678 - "HEAD", NULL, DEFAULT_REFLOG_ACTION);
678 + NULL, NULL, DEFAULT_REFLOG_ACTION);
679 error(_("\ngit encountered an error while preparing the "
680 "patches to replay\n"
681 "these revisions:\n"
@@ -1777,7 +1777,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1777 options.head_name ? options.head_name : "detached HEAD",
1778 oid_to_hex(&options.onto->object.oid));
1779 reset_head(the_repository, NULL, options.head_name,
1780 - RESET_HEAD_REFS_ONLY, "HEAD", msg.buf, NULL);
1780 + RESET_HEAD_REFS_ONLY, NULL, msg.buf, NULL);
1781 strbuf_release(&msg);
1782 ret = finish_rebase(&options);
1783 goto cleanup;