diff options
| author | Lidong Yan <502024330056@smail.nju.edu.cn> | 2025-06-03 02:01:13 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-03 08:33:01 -0700 |
| commit | 8b34b6a22038765e601692bee2e299eea14441d6 (patch) | |
| tree | 215630a4588a555c7026077e71d0bcb0cfc179ec /sequencer.c | |
| parent | b07857f7dcffee4d3b428df8dce6c9b49a57c9c1 (diff) | |
| download | git-8b34b6a22038765e601692bee2e299eea14441d6.tar.xz | |
sequencer: replace error() with BUG() in update_squash_messages ()
In sequencer.c, caller only pass TODO_SQUASH or TODO_FIXUP to
update_squash_messages(), any other command passed in should be
considered as BUG. Replace `return error('unknown command')`
with `BUG('not a FIXUP or SQUASH')`.
Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
| -rw-r--r-- | sequencer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c index 1ee0abbd45..9456ca6ee9 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2067,6 +2067,9 @@ static int update_squash_messages(struct repository *r, const char *message, *body; const char *encoding = get_commit_output_encoding(); + if (!is_fixup(command)) + BUG("not a FIXUP or SQUASH %d", command); + if (ctx->current_fixup_count > 0) { struct strbuf header = STRBUF_INIT; char *eol; @@ -2134,8 +2137,7 @@ static int update_squash_messages(struct repository *r, strbuf_addstr(&buf, "\n\n"); strbuf_add_commented_lines(&buf, body, strlen(body), comment_line_str); - } else - return error(_("unknown command: %d"), command); + } repo_unuse_commit_buffer(r, commit, message); if (!res) |
