Skip to content

fix: cancel edited commit message on interrupt#561

Open
pupuking723 wants to merge 1 commit into
di-sukharev:masterfrom
pupuking723:fix/edit-cancel-message
Open

fix: cancel edited commit message on interrupt#561
pupuking723 wants to merge 1 commit into
di-sukharev:masterfrom
pupuking723:fix/edit-cancel-message

Conversation

@pupuking723

Copy link
Copy Markdown

Fixes #560.

This prevents the Edit commit-message prompt from treating Ctrl+C as a literal commit message.

Root cause:

  • @clack/prompts returns a cancel symbol when the text prompt is interrupted.
  • The Edit path converted that value with toString(), so Symbol(clack:cancel) could be passed to git commit -m.

Changes:

  • Check isCancel(textResponse) before using the edited commit message.
  • Add an e2e regression test that interrupts the Edit text prompt and verifies no commit is created.
  • Keep the normal Edit flow covered to make sure edited commit messages still commit correctly.

Verification:

  • npm run build
  • npx jest test/e2e/cliBehavior.test.ts -t "cli flow cancels when editing the generated commit message is interrupted"
  • npx jest test/e2e/cliBehavior.test.ts -t "cli flow allows editing the generated commit message before committing"
  • npm run lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ctrl+C in "Edit" commit message step commits Symbol(clack:cancel) instead of cancelling

1 participant