]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: simplify handling of fixup with conflicts
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 15 Jul 2026 15:21:59 +0000 (16:21 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2026 19:16:21 +0000 (12:16 -0700)
Commit e032abd5a0 (rebase: fix rewritten list for failed pick,
2023-09-06) introduced an early return when res == -1, so if
we enter this conditional block then res is positive. After the
last couple of commits the only possible positive value is 1. That
means we can simplify the code by removing the conditional call to
intend_to_amend() and have error_failed_squash() request that it is
called in error_with_patch() instead.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c

index 70e12eab0ecf31173b75664e4365581fa41a9397..a00e3622c87d0d004b1c86b6d2347f239ea01310 100644 (file)
@@ -3874,7 +3874,7 @@ static int error_failed_squash(struct repository *r,
                return error(_("could not copy '%s' to '%s'"),
                             rebase_path_message(),
                             git_path_merge_msg(r));
-       return error_with_patch(r, commit, subject, subject_len, opts, 1, 0);
+       return error_with_patch(r, commit, subject, subject_len, opts, 1, 1);
 }
 
 static int do_exec(struct repository *r, const char *command_line, int quiet)
@@ -4986,8 +4986,6 @@ static int pick_one_commit(struct repository *r,
                record_in_rewritten(&item->commit->object.oid,
                                    peek_command(todo_list, 1));
        if (res && is_fixup(item->command)) {
-               if (res == 1)
-                       intend_to_amend();
                return error_failed_squash(r, item->commit, opts,
                                           item->arg_len, arg);
        } else if (res && is_rebase_i(opts) && item->commit) {