-
Notifications
You must be signed in to change notification settings - Fork 284
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
Auto-add of untracked files screws me up every time #323
Comments
Agreed on that — I think automatically committing tracked files is fine, but untracked is probably bad:
|
I mostly find the feature useful, but I also agree that it can be annoying and confusing. The worst case I've noticed is when you - perhaps accidentally - check out the root commit, where there's no When looking at an old version of the repo, you'll not see untracked files (e.g. |
I plan to use this matcher for some future `jj add` command (for #323). The idea is that we'll do a path-restricted walk of the working copy based on the intersection of the sparse patterns and any patterns specified by the user. However, I think it will be useful before that, for @arxanas's fsmonitor feature (#362).
I plan to use this matcher for some future `jj add` command (for #323). The idea is that we'll do a path-restricted walk of the working copy based on the intersection of the sparse patterns and any patterns specified by the user. However, I think it will be useful before that, for @arxanas's fsmonitor feature (#362).
Just to throw my 2c in: With the exception of new files that are also added to |
Just wanted to say that I really like the auto-tracking feature as well. After using jj for a while, going back to manually having to think about adding files to be tracked seems like a lot of extra work and possibly more error prone. I'm already used to checking |
The thing with accidentally committing GBs of Especially if you have something automatically creating it, like The only way is to recreate the repo (losing the oplog) this time not forgetting to ignore stuff/not editing old commits - which is kind of meh as well. Full GC of course means basically the same thing, only automated by a single command, but something like |
Maybe it is possible to track ignores in P.S. Can think of how |
Hm, so auto-tracking when you are doing changes in a working commit is the main killer feature. But for my issue with it, how about this: I know this is kind of magical, but the more I think about it the more it makes sense, idk - and the autorebase is magical on it's own, this somehow is kind of even consistent in my head |
It would be expensive to find the gitignores from all commits, but we could probably index that information. I'm more concerned that it would be unexpected behavior. For example, if you check out a sibling commit where Maybe it's better to check if the gitignores changed between the old and the new commit and if any untracked files according to the new patterns match the old patterns. If that happen, we could just print a warning about it. We could additionally add the ignores to a per-workspace set of ignores (which we don't support yet). (EDIT: I think this is what @ony suggested.) |
The warning being "those differences are implicitly untracked for this WC, in case your direnv caused GBs of files to generate in target and/or .direnv - add them to gitignore here or explicitly track them, moving to another commit without them ignored (e.g. ^ this is a loose idea, could be refined, for example |
Following @ony's suggestion, perhaps when the working copy moves to a new commit, we could track "newly unignored" files by comparing the old Then, the UI could provide ways for dealing with these files. E.g. there could be a command like |
I ran into this today when trying to checkout to a different branch that doesn't contain |
Ahh ignore my comment, I think I got confused - once there is an option to not auto-add untrack files |
You can pass jj op log --ignore-working-copy # "jj op log" also works with the current main branch
jj op restore --ignore-working-copy @-
jj workspace update-stale --some-option-to-not-snapshot-before-resetting |
Overall, it seems there is no good automated way to handle untracked files when creating commits. One one hand, not tracking them leads to incomplete commits. On the other hand, auto-tracking them leads to commiting of unwanted files. So how would you feel about some variation of the following semi-automated design?
I think this might strike a good balance between the following concerns:
For scripted operation, there should be a way to provide a default answer to the prompt via CLI arguments. |
I'm personally quite happy with the current behavior (except for the behavior when updating to a commit with different .gitignore). It can be a bit annoying in the beginning, but once you've added the appropriate paths, I find that it works pretty well. Maybe others feel differently. But even if they don't, we may want to make it less annoying for new users by doing something like you suggest. |
I'm not very happy with the idea of the interactive prompt. I think that if you edit a Other UIs will also do an analogue of |
Ah, yes, there's that. I knew that this design decision of having status commands modify the repository was fishy and going to cause problems someday... |
This feature has sadly made me bounce off of jj immediately every time I try it, which is really unfortunate because I keep hearing such good things about it, and want to give it a genuine try. Every single repository I work on regularly has various testing/strace-log/whatever files in its root. I actually don't mind auto tracking in fwiw a workaround for this that I've not yet checked works on jj might be some kind of terrible thing like so in the
This workaround is quite bad indeed, and I would rather not have to reimplement the git index in |
I have no idea whether this would be helpful you, but here's something that helped me a lot. I can't remember who had suggested it originally; it might be in the FAQ.
|
Yup it is in the FAQ or something; I've seen it given as advice before. I just don't like it and it doesn't vibe with how I work, since it would be a whole bunch of extra typing. I could have it be i/ or something, I guess, to reduce typing, but I would still have to remember to do it every time, which feels kind of bad? |
Inspired by more feedback (#3528 (comment)), perhaps @dpc 's suggestion from that post might work. Perhaps we could have a notion of "untracked" files, like Git, and default files to "untracked", while also auto-updating all the tracked files on each command?
One question is what This would be a huge change, so I almost certainly missed some important considerations. |
Speaking out of ignorance, I'm guessing Hmm... I guess |
If we add support for untracked files, I think it should be pretty much only
I don't think so. Almost all commands, and probably also the future |
OK, it's not overwritten, but it's tracked and I didn't track it. If I |
Yes. This is the case I was trying to describe earlier |
I applied my own advice to myself, went through the whole issue again and I admit the examples given so far were pretty vague and possibly difficult to picture for tidy people, especially if you think littering the working copy is a bad habit not worth discussing. Of course these filenames are much shorter and much more cryptic in "real life" but their purpose and name randomness are the same.
etc. "Auto-stashing" of such temporary files is not a feature: it's a bug because they're useful ACROSS commits and branches. A) I admire organized people who are in a similar situation but who 1) can categorize all the types of temporary files they will use 2) decide in advance some naming convention for each type (e.g. "build*", "*logs") and add it to some gitignore file 3) carefully follow their own naming convention. I'm not that organized, rigorous and disciplined. I don't think I'm alone and TBH I'm afraid I don't want to be that organized. B) As already mentioned by others, I really don't want to move these temporary files out of the working copy and into some ../temp_for_projectX/ or /tmp directory because it's further away, less convenient and because they're 100% related to projectX and the activity happening inside that particular workspace. Such temporary files belong to the working copy - but not to any commit or stash. C) This last and less important preference may be more personal and less common: I actually don't want "temporary files with random filenames" to be gitignored and hidden from "git status". Because "git status" is the perfect tool to list those files, to remind me their bad filename that I just forgot I wrote, to remind me that I forgot to do something with them and to show the scraps on my kitchen counter that I need to clean up when I'm done. Very different from the regular, predictable build/ directory which is better gitignored and hidden. I don't mind if litter stay hidden in "jj status" if that makes things easier for Once again: I'm suggesting ZERO change to the current, default behavior. Having something "opt-in" would be awesome enough. I don't think anyone remotely suggested to change any default behavior either so please don't answer any non-existent suggestion to change the default behavior: it just makes this already long thread even longer. For instance I believe that any new fear of forgetting to add new files is void: just keep using Hope these examples help tidy people understand us the dirty ones. |
I think pretty much every version control system invented so far besides
|
@marc-h38: Thanks for explaining with some concrete examples. Hopefully that helped explain it to anyone who was still against the feature. I haven't seen any arguments against the feature (I've only heard some people say that they wouldn't personally use it). If anyone is concerned that it complicates the design or the conceptual model too much, please say so. What do you think, @yuja? Are you interested in implementing this feature, @marc-h38? |
Is this one of those options that makes a command work differently for different users? What is the definition of options that can do that and options that are unwanted because they do that? Given the explanation of a "dirty" workflow, it seems answered in the FAQ.
|
I don't feel strongly myself. Maybe the main problem with aliases is that you can redefine a command to behave in ways that are not defined by any config option (other than the alias definition itself). For example, if we get a bug report saying that some branch disappeared and the user said they did |
It actually looks pretty easy to add at least a basic version of this feature. I'll probably send a PR for that this weekend or next weekend (trying to focus on work priorities during the week). |
I'm not against this feature. I personally wouldn't want to see random junks in I think people agreed that
|
This is what I'm going for (with a default of |
The draft in #4338 seems to work (though I've only written a single test case so far). I need to add more tests and also make |
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
Oh my god I've been busy and missed all of this.
What I've been saying, and I might be wrong as I was working purely on assumptions without actually looking at code, is this: The snapshotting process at some point looks at the working dir to snapshot the files, right. I'm pretty sure the #4338 does not do what I wanted, unless I'm misunderstanding, as described it seems like it disables tracking entirely for configured paths - which is a feature, of course, just different to what I meant My point was that we could have a balance between having to track every single thing and the ease of autotracking, by only requiring to manually track adding new files (might've been better described by my little pseudo-algorithm above). |
Looking just a bit more into the #4338 it repeatedly uses wording "track new files that match the pattern", so may be it does exactly what I wanted and I indeed misunderstood 🙃 And I could even have everything in src/ auto-tracked which is even better |
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
It's a pretty frequent request to have support for turning off auto-tracking of new files and to have a command to manually track them instead. This patch adds a `snapshot.auto-track` config to decide which paths to auto-track (defaults to `all()`). It also adds a `jj track` command to manually track the untracked paths. This patch does not include displaying the untracked paths in `jj status`, so for now this is probably only useful in colocated repos where you can run `git status` to find the untracked files. #323
Description
Initially I thought the auto-add of files was a neat idea, but in practice I just leave untracked files in my repo all the time, and tools like
patch
(1) assume they can drop.orig
or similar files in the WC without it being a problem. I think every time I've usedjj
I've ended up getting grumpy at auto-adds and having to rip something out of a commit, sometimes after doing a push (when it was effectively emulatinghg import
for example).Steps to Reproduce the Problem
patch -p1 < some.diff
(or similar)jj describe && jj close && jj git push
Expected Behavior
I (still) don't expect auto-adds, and it really surprises me every time, plus it's super frustrating to have to ignore every file spec I might create as a temporary scratch file or what have you.
Actual Behavior
As above.
Specifications
The text was updated successfully, but these errors were encountered: