cli: run: add sparse patterns options - #9980
Draft
mirkomartn wants to merge 2 commits into
Draft
Conversation
Expose SparseSetArgs so that it can be used for exposing the same set of arguments for sparse set subcommand as part of another command as well. It might be desirable to offer knobs for setting sparse patterns as part of another command (such as `run` or `workspace`).
This uses previously exposed sparse::SparseSetArgs to add a familiar interface for setting sparse patterns in the "workspace" in which the command is run. This gives the user an option to forego expensive materializations when unneeded. For example, if a user only needs to run a command only for two files `bar` and `foo`, they can now do so with: `jj run --clear --add bar --add foo -- <command>`
mirkomartn
force-pushed
the
gs/run-sparse-patterns
branch
from
August 13, 2026 14:01
1cf3a5e to
fba9130
Compare
Author
|
Re: --remove performing poorly, just two |
mirkomartn
marked this pull request as draft
August 13, 2026 14:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a way to add sparse patterns to the
runcommand. Current implementation is very simple if not crude, but I don't think the final version (if accepted) will differ substantially. I left a few comments with TBD items, probably best discussed inline.I do want to emphasize one thing though, namely, that
--removepattern doesn't perform nearly as well as what should be an otherwise equivalent set of--clearand--addcommands, and I'm not sure whether this is expected or not (didn't have time to dig into it yet, as I only run into it preparing the example below while opening this PR). Most likely, this is an error on my side, so please review with this in mind.If there proves to be interest in the feature, I'll add tests and check off other items of the list.
I think this can really make a difference, for example (in short, having a 4GB file,
jj run -- lswon't complete in under 10s, but now we can exclude the big file using a sparse pattern and then it do so instantly (not with--removethough)):Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,demos/)cli/src/config-schema.json)how it works, how it's organized), including any code drafted by an LLM.
an eye towards deleting anything that is irrelevant, clarifying anything
that is confusing, and adding details that are relevant. This includes,
for example, commit descriptions, PR descriptions, and code comments.