Skip to content

sequencer: replace error() with BUG() in update_squash_messages()

Lidong Yan via GitGitGadget git 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 1 replyIn review
  2. v32 patches 2 repliesSuperseded
  3. v21 patch 4 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sequencer: replace error() with BUG() in update_squash_messages()sequencer.c+4 -20 replies
2/2BUG(): remove leading underscore of the format stringbuiltin/mktag.c builtin/worktree.c pack-bitmap-write.c+3 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

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

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').

@@ 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("...")

Signature · 1 line
gitgitgadget