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

Closed
peacememories opened this issue Mar 4, 2024 · 1 comment

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
Collaborator

yuja commented Mar 4, 2024

Previous discussion in
#323 (comment)

(Closed as duplicates)

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

2 participants