jj icon indicating copy to clipboard operation
jj copied to clipboard

cli: add global option to not commit transaction

Open martinvonz opened this issue 1 year ago • 3 comments

Checklist

If applicable:

  • [x] I have updated CHANGELOG.md
  • [ ] I have updated the documentation (README.md, docs/, demos/)
  • [ ] I have updated the config schema (cli/src/config-schema.json)
  • [x] I have added tests to cover my changes

martinvonz avatar Sep 13 '24 06:09 martinvonz

This pr doesn't seem to have a link to #2562 -- adding with this message

bryceberger avatar Jun 06 '25 02:06 bryceberger

I have a couple questions, based on my interpretation of the intent of this PR:

Besides a global flag for most jj commands, could it be possible to make this behaviour controllable via an env var? Because in most use cases (again, if I understand correctly the goal here), you are likely to want to bunch together quite a few jj operations in the same "transaction block". Exposing an env var to the whole block would make sure you don't forget to add --no-commit-transaction to one operation.

Is the goal to also add a new command like jj op commit-transaction to actually commit? Or should we just run the last operation without the --no-commit-transaction flag? The latter API seems less convenient to use in practice in scripts, as you'd need to special case the last operation just for the sake of compliance with this API.

YPares avatar Jun 11 '25 13:06 YPares

Besides a global flag for most jj commands, could it be possible to make this behaviour controllable via an env var?

I don't think env var will help. You'll need to run jj with --at-op <prev-op-id> to chain unpublished commands anyway. I assume a convenient interface will be added by jj api or something.

Is the goal to also add a new command like jj op commit-transaction to actually commit?

That could be.

yuja avatar Jun 11 '25 14:06 yuja