]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: return early from pick_one_commit() on success
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Tue, 30 Jun 2026 15:28:59 +0000 (16:28 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Jun 2026 19:03:14 +0000 (12:03 -0700)
The only block that does not return early is the one guarded by
"!res". Move the return into that block to make it clear that after
recording the commit as rewritten all we do is return from the function.

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

index 416729f30a7c7aad9c3c34c3a83be91ed410719c..655a2e84befc5c8c8af87420c8f90a704dff24ea 100644 (file)
@@ -4986,6 +4986,7 @@ static int pick_one_commit(struct repository *r,
        } else if (!res) {
                record_in_rewritten(&item->commit->object.oid,
                                    peek_command(todo_list, 1));
+               return 0;
        } else if (res && is_fixup(item->command)) {
                return error_failed_squash(r, item->commit, opts,
                                           item->arg_len, arg);
@@ -5009,7 +5010,8 @@ static int pick_one_commit(struct repository *r,
                return error_with_patch(r, item->commit, arg, item->arg_len,
                                        opts, res, to_amend);
        }
-       return res;
+
+       BUG("Unhandled return value from do_pick_commit()");
 }
 
 static int pick_commits(struct repository *r,