Skip to content

feat(terminal): git commit without -m opens $EDITOR - #2539

Merged
chaliy merged 2 commits into
mainfrom
claude/project-thread-vu3h37
Oct 7, 2026
Merged

chaliy merged 2 commits into
mainfrom
claude/project-thread-vu3h37

Conversation

@chaliy

@chaliy chaliy commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

What changed

  • In a terminal session, git commit without -m opens the editor on .git/COMMIT_EDITMSG, pre-filled with git's template, as real git does. Saving and quitting commits. Lines starting with # are dropped. An empty message aborts with git's message and exit 1, and so does :cq.
  • vi gains :cq, which quits with exit status 1.
  • Sessions set EDITOR=vi when it is unset. $VISUAL/$EDITOR are honored only as far as naming vi/vim; any other editor is reported as unavailable instead of being silently replaced.
  • Outside a terminal, git commit without -m behaves as before (error: switch 'm' requires a value).

Why

Agents and users driving a terminal hit $EDITOR flows. With this change, git commit behaves like a real shell instead of failing. git rebase -i and crontab -e are not covered because neither command exists in bashkit. The new builtins::edit_file helper is the hook for future commands that need an editor.

Before / After

$ git commit
Before: error: switch 'm' requires a value
After:  vi opens on COMMIT_EDITMSG; Ofirst line<Esc>:wq commits "first line"
$ git commit         # then :wq with only the template
After:  Aborting commit due to empty commit message.   (exit 1)

Tests: terminal::tests::{git_commit_without_m_opens_editor, git_commit_editor_abort_paths, vi_cq_exits_nonzero}. The CI terminal step now runs with --features terminal,git so these tests execute. Locally, all 2856 lib tests pass with --features terminal,git, clippy is clean with and without terminal, and the git-only build is clean.

Risk

  • Low. All changes are behind the terminal feature, which is off by default.
  • The editor runs in-process from inside the git builtin, with no shell re-entry and no subprocess.

Checklist

  • Tests added or updated
  • Backward compatibility considered (non-terminal behavior unchanged)

Generated by Claude Code

Inside a terminal session git commit with no -m edits
.git/COMMIT_EDITMSG in vi (git's template, # lines dropped, empty message
or :cq aborts). vi :cq now exits 1. Sessions set EDITOR=vi; other editors
are reported as unavailable.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 426013e Commit Preview URL

Branch Preview URL
Oct 07 2026, 05:03 AM

@chaliy
chaliy merged commit 6b70142 into main Oct 7, 2026
47 checks passed
@chaliy
chaliy deleted the claude/project-thread-vu3h37 branch October 7, 2026 05:33
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.

1 participant