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

Initially-gitignored file continually reappears (with watchman) #2613

Open
glencbz opened this issue Nov 22, 2023 · 4 comments
Open

Initially-gitignored file continually reappears (with watchman) #2613

glencbz opened this issue Nov 22, 2023 · 4 comments
Labels
🐛bug Something isn't working

Comments

@glencbz
Copy link
Contributor

glencbz commented Nov 22, 2023

Description

In some cases, a .gitignored file in one commit can get tracked by another commit, but the file seems to stick around in the working copy outside of the commits, ready to be tracked again!

The commit topology is like:

@
|
A  B
| /
P

where in A, there is a .gitignore that ignores /path/to/ignored. /path/to/ignored is in the working copy. B doesn't have the .gitignore

now, checking out B:

   @
   |
A  B
| /
P

puts /path/to/ignored in @.

Other, possibly relevant information:

  • /path/to/ignored is owned by root (it was generated by something in a Docker container).
  • /path/to/ignored is binary.

Expected/Actual Behavior

  • jj abandon should delete the file and recreate an empty working copy commit. Instead, the newly created working copy commit still has /path/to/ignored.
  • jj co B should create an empty working copy commit. Instead, every working copy commit has /path/to/ignored in it (also causing the working copy commits to not be auto-abandoned).
  • jj co <yet another unrelated commit> after jj co B also gives similar results to jj co B

Fixable by deleting /path/to/ignored, as one might expect.

Specifications

@yuja
Copy link
Collaborator

yuja commented Nov 22, 2023

Do you enable watchman? The un-ignored file is unmodified in the working copy, so it wouldn't be detected by watchman.

Perhaps, watchman clock would need to be reset on ignore pattern changed, (or contain hash of active ignore patterns) to detect changes.

@glencbz
Copy link
Contributor Author

glencbz commented Nov 23, 2023

Dumb question: how can I tell if I've enabled watchman? 😅

@yuja
Copy link
Collaborator

yuja commented Nov 23, 2023

Try jj config list core.fsmonitor. It's disabled by default. jj status -v will also print something like "Querying Watchman".

I can reproduce the problem with fsmonitor = "watchman".

@PhilipMetzger PhilipMetzger added the 🐛bug Something isn't working label Nov 28, 2023
@ilyagr ilyagr changed the title Initially-gitignored file continually reappears Initially-gitignored file continually reappears (with watchman) Jun 16, 2024
@ilyagr
Copy link
Collaborator

ilyagr commented Jun 16, 2024

Minor updates to Yuya's last comment: these days, you can use jj debug watchman status and other jj debug watchman commands. Today, it would also be jj status --debug instead of jj status -v.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants