jj icon indicating copy to clipboard operation
jj copied to clipboard

cli: add `--stdin` and `--edit` flags to `jj commit`

Open tekacs opened this issue 2 months ago • 3 comments

Add --stdin flag to read commit messages from stdin, matching the existing pattern in jj describe. This solves the problem of passing multi-line commit messages from scripts and the command line without shell escaping issues.

Add --edit flag to allow opening an editor after providing a message via --stdin or -m, enabling users to refine messages in two stages.

Implementation:

  • Added proper conflicts: --stdin cannot be used with -m, --interactive, or --tool
  • Restructured description handling to check stdin first, then -m flags, then fall back to editor
  • Introduced use_editor variable to control editor invocation
  • Trailers are properly handled in all code paths

This brings jj commit to feature parity with jj describe for message input methods.

Checklist

  • Added CHANGELOG entry
  • Added comprehensive tests for stdin functionality
  • All existing tests pass

tekacs avatar Oct 13 '25 06:10 tekacs

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Oct 13 '25 06:10 google-cla[bot]

Signed the CLA

tekacs avatar Oct 13 '25 06:10 tekacs

Comments should be resolved!

tekacs avatar Oct 16 '25 23:10 tekacs