cli: add snapshot.derive-tracked-from-ignores option#9108
cli: add snapshot.derive-tracked-from-ignores option#9108valtron wants to merge 1 commit intojj-vcs:mainfrom
snapshot.derive-tracked-from-ignores option#9108Conversation
|
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. |
|
I can't tell from my cursory look at your code, but it seems like there would be an interaction with the |
Yeah, if a file is ignored, it overrides it, otherwise same logic as before applies. I updated the docs to explain it a bit more, as well hints in |
|
Have you seen #7237? I think I'm currently leaning towards option 3 in this comment. |
|
I took at a look at that issue, but it seems orthogonal (please correct me if you don't think so) to this proposal. (This is more for solving this problem, which I also ran into and it confused me.) Running Option (d) seems reasonable to me! I would see the error, add the file to In your comment, I think you're tackling a more general problem (how to handle failed working copy updates when applying an operation). I don't understand the internals well, so I don't know what's right for any operation [2]... but specifically for [1] I'd go even further and say that |
|
Perhaps what you're missing is that |
|
Yeah that makes sense, but what I meant with (d) is that Here's a concrete example based on #5596: $ jj git init
Initialized repo in "."
Hint: Running `git clean -xdf` will remove `.jj/`!
$ jj new
Working copy (@) now at: wlxqukvt 8bbfeea3 (empty) a
Parent commit (@-) : oxulxukl f459f1ee (empty) (no description set)
$ echo ignored > .gitignore
$ touch ignored
$ jj op log
@ e0356873d390 u@h now, lasted 19 milliseconds
│ snapshot working copy
│ args: jj op log
○ 796b690a1a28 u@h 36 seconds ago, lasted 28 milliseconds
│ new empty commit
│ args: jj new
○ 823d2926f3c7 u@h 39 seconds ago, lasted 22 milliseconds
│ add workspace 'default'
○ 000000000000 root()
$ jj edit @-
Error: The following files are ignored in the working copy but not in the target commit:
ignored
hint: delete the files or exclude them using `.git/info/exclude`
$ jj op log # unchanged
@ e0356873d390 u@h now, lasted 19 milliseconds
│ snapshot working copy
│ args: jj op log
○ 796b690a1a28 u@h 36 seconds ago, lasted 28 milliseconds
│ new empty commit
│ args: jj new
○ 823d2926f3c7 u@h 39 seconds ago, lasted 22 milliseconds
│ add workspace 'default'
○ 000000000000 root() |
|
There are many other commands than |
|
Right. I guess my confusion around handling errors when updating the working copy and what's best was because I'm mentally grouping them into two kinds:
|
This is a proposal for a new feature (opt-in via config) to alleviate the issue mentioned in #323. I skimmed the ~200 comments and didn't see this exact idea discussed there, though some were similar, particularly #323 (comment) ("There should be one source of truth for ignored or not. I assume this to be the ignore file." by @joyously is a nice way of putting it). In a sense this PR is the opposite of #8628. Also, this PR would touch on #6157.
This PR adds config
snapshot.derive-tracked-from-ignores(tentative name), which iftrue, treats the ignores as the "source of truth" for what should be tracked, or rather, what should not be tracked:jj statusshould show it as deletedjj statusshould show it as addedThe new test
test_derive_tracked_from_ignoreschecks exactly this.Additionally, if
snapshot.derive-tracked-from-ignoresis set, I also madejj {un,}trackerror, because that conflicts with ignores being the source of truth.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.