-
Notifications
You must be signed in to change notification settings - Fork 343
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
Adding a gitignore after the fact is difficult to clean up #3203
Comments
After the step 5, you'll need to run Perhaps, |
Ah thanks, I guess I missed |
This has tripped me up before, and while |
It seems just the opposite of #3204. |
We may want to consider the parent of the working copy when snapshotting the working copy. We currently only consider the previous snapshot of the working copy itself.
No. Maybe we will one day, or maybe not. |
Is there special handling for |
No |
It makes sense though as it inverses the |
Encountered this as a fresh git convert. What compounded my confusion is that the documentation is outdated: https://github.com/martinvonz/jj/blob/6498a0cf8a5053e8a55fb503800e11b00953ecdc/docs/working-copy.md?plain=1#L60-L61 and contradicts an existing test case https://github.com/martinvonz/jj/blob/8e4d1af98eccf1ed8a79a7ddf9500467aa7684f5/cli/tests/test_gitignores.rs#L41-L47 |
Thanks for letting us know! I'll send a PR to fix it. |
+1 would love a hint to use |
An interesting special case of this: when switching the working copy to before/after .gitignore changes (see #4349). While it's not "wrong" for jj to leave the untracked file around and then snapshot them as new/deleted, that's especially frustrating and silent in jj vs. git (like after doing |
I think every time you have a added file that's also ignored. I think we would have to implement that in the snapshotting code, so the working copy is the only thing that knows about the |
Btw, note that both listing untracked files (after #4338) and listing ignored-but-added files requires walking the working copy, which means these features won't work well with background snapshotting. I don't know what to do about that. |
Description
When adding files to the gitignore after jj has recognized them as new files, it is rather difficult to remove them from the automatically created commit again.
I ended up using git to manually create a new commit and work from there, but ideally, jj would recognize when a file added in the current commit has also been added to the gitignore.
Steps to Reproduce the Problem
git init
jj init --git-repo=.
touch testfile
jj st
echo "testfile" > .gitignore
jj st
Expected Behavior
Ideally, the
testfile
would not be part of the created commit.Actual Behavior
testfile
as well as.gitignore
are marked as "added" in the commit.Specifications
NixOS 23.11
jj 0.13.0
The text was updated successfully, but these errors were encountered: