martinvonz / jj

A Git-compatible VCS that is both simple and powerful
https://martinvonz.github.io/jj/
Apache License 2.0
8.31k stars 284 forks source link

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

Open glencbz opened 10 months ago

glencbz commented 10 months ago

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:

Expected/Actual Behavior

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

Specifications

yuja commented 10 months ago

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 commented 10 months ago

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

yuja commented 10 months ago

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".

ilyagr commented 3 months ago

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.