Subject: [PATCH v4 0/2] sequencer: replace error() with BUG() in update_squash_messages()

From: "Lidong Yan via GitGitGadget" <[email-masked]>
Date: Tue, 03 Jun 2025 02:01:12 +0000

Lidong Yan (2):
  sequencer: replace error() with BUG() in update_squash_messages()
  BUG(): remove leading underscore of the format string

 builtin/mktag.c     | 2 +-
 builtin/worktree.c  | 2 +-
 pack-bitmap-write.c | 2 +-
 sequencer.c         | 6 ++++--
 4 files changed, 7 insertions(+), 5 deletions(-)

base-commit: fcfe60668e05ffde2610bfef9045797618c145ac
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1964%2Fbrandb97%2Ffix-sequencer-leak-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1964/brandb97/fix-sequencer-leak-v4
Pull-Request: https://github.com/git/git/pull/1964

Range-diff vs v3:

 1:  b812f973d18 ! 1:  f2d2cfd6a87 sequencer: replace error() with BUG() in update_squash_messages()
     @@ Commit message
      
          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. Thus I think `return error('unknown command')`
     -    should be replaced as `BUG('unknown command')`.
     +    considered as BUG. Replace `return error('unknown command')`
     +    with `BUG('not a FIXUP or SQUASH')`.
      
          Signed-off-by: Lidong Yan <[email-masked]>
      
     @@ sequencer.c: static int update_squash_messages(struct repository *r,
       	const char *encoding = get_commit_output_encoding();
       
      +	if (!is_fixup(command))
     -+		BUG("unknown command: %d", command);
     ++		BUG("not a FIXUP or SQUASH %d", command);
      +
       	if (ctx->current_fixup_count > 0) {
       		struct strbuf header = STRBUF_INIT;
 2:  e1f84c111f6 ! 2:  9d69c19273b BUG(): remove leading underscore of the format string
     @@ Commit message
          BUG(): remove leading underscore of the format string
      
          BUG() is not end-user facing but programmer facing, and we do not
     -    use _("...") in them. I searched all `BUG(_` pattern and replace
     -    them with `BUG(`
     +    use _("...") in them. Replace all `BUG(_("..."))` with `BUG("...")`
      
          Signed-off-by: Lidong Yan <[email-masked]>

-- 
gitgitgadget