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

Switching to a past change where a file has not been ignored adds it to the change. #3204

Open
peacememories opened this issue Mar 4, 2024 · 4 comments

Comments

@peacememories
Copy link

Description

When new files are added to a gitignore, these become kind of a boobytrap for editing old changes. As soon as you switch to an old change where the file are not ignored yet, they are added to the change since they are in the working copy. This means that, without actively changing anything, and mostly without feedback, you have added files to the repo which you never wanted to be in there.

This is especially awkward when automating commands over a set of changes (I did that to automate pre-commit runs for the branch I am working on).

One possible solution to this: When switching between changes, find all files which have been previously .gitignored, and delete them. I realize that this might trash caches for people on a regular basis, but I think this is preferable to accidentally checking in files without noticing.

Steps to Reproduce the Problem

  1. Find a change where a specific file does not exist, let's call it c
  2. jj new c
  3. echo "newfile" >> .gitignore
  4. touch newfile
  5. jj edit c

Expected Behavior

newfile should not be automatically added to the commit

Actual Behavior

newfile is added to the commit.

Specifications

  • Platform: NixOS 23.11
  • Version: jj 0.13.0
@yuja
Copy link
Contributor

yuja commented Mar 4, 2024

Previous discussion in
#323 (comment)

(Closed as duplicates)

@martinvonz
Copy link
Member

@yuja, do you think we should reopen this bug and close #323? That bug has a very long discussion and I can't remember all of it, but I think it's all done except for the solution to the problem described in this bug.

@yuja
Copy link
Contributor

yuja commented Jan 18, 2025

do you think we should reopen this bug and close #323? That bug has a very long discussion and I can't remember all of it, but I think it's all done except for the solution to the problem described in this bug.

You mean #323 is resolved by snapshot.auto-track? That makes sense to me.

@martinvonz
Copy link
Member

You mean #323 is resolved by snapshot.auto-track? That makes sense to me.

Yes, in combination with #5138 (showing untracked files in jj status). Alright, I'll reopen this and close the other one then.

@martinvonz martinvonz reopened this Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants