Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Option to not commit transaction #2562

Open
necauqua opened this issue Nov 9, 2023 · 2 comments
Open

FR: Option to not commit transaction #2562

necauqua opened this issue Nov 9, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@necauqua
Copy link
Contributor

necauqua commented Nov 9, 2023

Is your feature request related to a problem? Please describe.

There are two points for this:

  • Some things, like startship or maybe the intellij plugin I was experimenting with, need to know the state of the jj repo constantly, and I don't want to snapshot the repo every second - I know in some situations that's fine, but often you want more control, especially in cases when editing .gitignore, etc
  • I will never get over the auto-amend happenning on every single command including readonly ones, when often I feel like I don't need it. --ignore-working-copy could've helped (at least in log it does), but the whole point is that I want to see changes I just did but not amend them, leaving the repo stale until I run some meaningful command and not obsess over running diff/status every second making snapshots.
    For now I often run git status and git diff (and also starship shows git numbers, but there are different numbers between untracked and staged which is wonky), but I'd love to use jj only.

Describe the solution you'd like

jj util stale diff [-r @] - jj diff but between the @ (or other) and the physical state of the files in working copy, --ignore-working-copy (meaning no snapshot made) implied.

It is under the util subcommand (and not, say, jj diff --stale) because it essentially is git staging, which I feel like you wouldn't want to have among first-class commands, this is an "advanced", "low-level-ish" feature (useful, again, in things like starship) - although if you're ok with jj diff --stale, so am I.
Maaaybe there could be a jj stale [verb] set of commands, which is "officially discouraged" as it goes against the amend-everything principle :)
Or maybe I'll write a jj-stale program that will just do all of that and be unofficial, and could be called by jj stale when we enable external subcommands

Another thing would be jj util stale status (jj stale status? :) ) which is just like jj status, but does not snapshot - the difference from jj status --ignore-working-copy is that here the latter ignores the stale changes (it just works with the wc commit which wasn't amended), the stale-status should show the same thing jj status would've shown if the snapshot did happen - except it shouldn't

@martinvonz
Copy link
Member

I think the best way of doing that would be with a global --no-commit-transaction flag. We would still create the commit and add the refs/jj/keep-* ref, but if we don't commit the transaction, it won't be visible afterwards. We would need to implement GC (#12) for the refs/jj/keep-* to get GC'd. Alternatively, if we implement #50, we could postpone creating the refs/jj-keep* refs until the transaction commits (which means we wouldn't create the refs with --no-commit-transaction).

@necauqua
Copy link
Contributor Author

necauqua commented Nov 9, 2023

That.. actually solves all of my problems, and seems not patched on, that's great, yes

@martinvonz martinvonz added the good first issue Good for newcomers label Nov 13, 2023
@martinvonz martinvonz changed the title FR: jj util stale diff and jj util stale status FR: Option to not commit transaction Jun 5, 2024
martinvonz added a commit that referenced this issue Sep 13, 2024
This patch adds a global `--no-commit-transaction` flag that prevents
publishing of most operations, including the ones created by
`snapshot_working_copy()` and `finish_transaction()`. The operations
are still created as usual.

We may want to follow up with a `jj op publish/commit/adopt` command
for publishing an operation that was not committed.

Closes #2562
martinvonz added a commit that referenced this issue Sep 13, 2024
This patch adds a global `--no-commit-transaction` flag that prevents
publishing of most operations, including the ones created by
`snapshot_working_copy()` and `finish_transaction()`. The operations
are still created as usual.

We may want to follow up with a `jj op publish/commit/adopt` command
for publishing an operation that was not committed.

Closes #2562
martinvonz added a commit that referenced this issue Sep 13, 2024
This patch adds a global `--no-commit-transaction` flag that prevents
publishing of most operations, including the ones created by
`snapshot_working_copy()` and `finish_transaction()`. The operations
are still created as usual.

We may want to follow up with a `jj op publish/commit/adopt` command
for publishing an operation that was not committed.

Closes #2562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants