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

Non-actionable "conflicting changes in the working copy" message possible when changing to commit with different gitignore #5602

Open
ilyagr opened this issue Feb 6, 2025 · 4 comments

Comments

@ilyagr
Copy link
Contributor

ilyagr commented Feb 6, 2025

Update: Yuya points out below this might be watchman-related. I did have both watchman and core.watchman.register_snapshot_trigger enabled during the reproduction.

Description

I can get a repo into a situation when I get a non-actionable message

$ jj next
Working copy now at: xqlkmt ccb2a0f (empty) (no description set)
Parent commit      : xuwtoq b814c10 2
Added 1 files, modified 1 files, removed 1 files
Warning: 1 of those updates were skipped because there were conflicting changes in the working copy.
Hint: Inspect the changes compared to the intended target with `jj diff --from ccb2a0fc5d87`.
Discard the conflicting changes with `jj restore --from ccb2a0fc5d87`.
$ jj diff --from ccb # No output
$ jj restore --from ccb2a0fc5d87
Nothing changed
$ cat qq
something
$  jj file show qq
something else

Steps to Reproduce the Problem

Start with the following repo state. You can also download jj-localignoretest.tar.gz.

The key point is that commit 2 has a file qq
with contents "something else" while commit 1 has a .gitignore that includes qq.
Then, you do jj new commit1.

$ jj log --patch --git
@  tsmuux ilyagr@users 26 seconds ago 8aacee6
│  (empty) (no description set)
│ ○  xuwtoq ilyagr@users 37 seconds ago b814c10
├─╯  2
│    diff --git a/.gitignore b/.gitignore
│    deleted file mode 100644
│    index b26b2efe69..0000000000
│    --- a/.gitignore
│    +++ /dev/null
│    @@ -1,1 +0,0 @@
│    -qq
│    diff --git a/qq b/qq
│    new file mode 100644
│    index 0000000000..3dfdc59b46
│    --- /dev/null
│    +++ b/qq
│    @@ -0,0 +1,1 @@
│    +something else
○  lzxkyw ilyagr@users 2 minutes ago 81435d5
│  1
│  diff --git a/.gitignore b/.gitignore
│  new file mode 100644
│  index 0000000000..b26b2efe69
│  --- /dev/null
│  +++ b/.gitignore
│  @@ -0,0 +1,1 @@
│  +qq
◆  zzzzzz root() 0000000

Then, do

$ echo something > qq
$ jj diff # No output, as expected.
$ jj next
Working copy now at: xqlkmt ccb2a0f (empty) (no description set)
Parent commit      : xuwtoq b814c10 2
Added 1 files, modified 1 files, removed 1 files
Warning: 1 of those updates were skipped because there were conflicting changes in the working copy.
Hint: Inspect the changes compared to the intended target with `jj diff --from ccb2a0fc5d87`.
Discard the conflicting changes with `jj restore --from ccb2a0fc5d87`.

Expected Behavior

An actionable message. (Haven't yet thought about what)

Actual Behavior

As already described above, following the instructions does not help

$ jj diff --from ccb # No output
$ jj restore --from ccb2a0fc5d87
Nothing changed
$ cat qq
something
$  jj file show qq
something else

Specifications

  • Platform: aarch64-darwin
  • Version: 0.26
@ilyagr ilyagr changed the title Confusing "conflicting changes in the working copy" message possible when changing to commit with different gitignore Non-actionable "conflicting changes in the working copy" message possible when changing to commit with different gitignore Feb 6, 2025
@ilyagr
Copy link
Contributor Author

ilyagr commented Feb 6, 2025

Something similar happens on a case-insensitive filesystem (easy to get on Mac or Windows) for

○  rmvxwy ilyagr@users 38 seconds ago af02150
│  change case
│  Added regular file QQ:
│          1: third thing
│  Removed regular file qq:
│     1     : something else

if you jj new r-; jj new r.

Thanks to @jennings , who may or may not file another bug for this.

Aside: For Linux, there is https://www.brain-dump.org/projects/ciopfs/ for making case-insensitive filesystems, which I've never tried.

@ilyagr
Copy link
Contributor Author

ilyagr commented Feb 6, 2025

Also, an FR: the message could list the paths of problematic files (all of them, or a subset if there are many).

@yuja
Copy link
Contributor

yuja commented Feb 6, 2025

Can you test without watchman? I suspect our watchman integration doesn't handle skipped files properly.

@ilyagr
Copy link
Contributor Author

ilyagr commented Feb 6, 2025

Indeed, great point! I had it on, and running jj config set --repo core.fsmonitor "none" makes a difference.

Now, it acts as follows for the qq->QQ example. I'm still not sure I'm happy about it (the error message could be clearer), but it is definitely better than with Watchman.

🐟 jj log --patch -r next
○  rmvxwy ilyagr@users 18 minutes ago af02150
│  change case
~  Added regular file QQ:
           1: third thing
   Removed regular file qq:
      1     : something else
[22:49] macaw ~/tmp/jj-localignoretest <x>→<p|∅>
🐟 cat qq
something else
[22:49] macaw ~/tmp/jj-localignoretest <x>→<p|∅>
🐟 jj next
Working copy now at: qrpptt 58f48d5 (empty) (no description set)
Parent commit      : rmvxwy af02150 change case
Added 1 files, modified 0 files, removed 1 files
Warning: 1 of those updates were skipped because there were conflicting changes in the working copy.
Hint: Inspect the changes compared to the intended target with `jj diff --from 58f48d577324`.
Discard the conflicting changes with `jj restore --from 58f48d577324`.
[22:49] macaw ~/tmp/jj-localignoretest <r>→<q|∅>
🐟 cat qq
cat: qq: No such file or directory
[22:50] macaw ~/tmp/jj-localignoretest [1] <r>→<q|∅>
🐠 jj diff --from 58f
Removed regular file QQ:
   1     : third thing
[22:50] macaw ~/tmp/jj-localignoretest <r>→<q>
🐟 jj restore --from 58f
Created qrpptt cdc5bc8 (empty) (no description set)
Working copy now at: qrpptt cdc5bc8 (empty) (no description set)
Parent commit      : rmvxwy af02150 change case
Added 1 files, modified 0 files, removed 0 files
[22:50] macaw ~/tmp/jj-localignoretest <r>→<q|∅>
🐟 jj diff
[22:50] macaw ~/tmp/jj-localignoretest <r>→<q|∅>
🐟 cat qq
third thing

Note that the author of the mysterious Discord report on Windows says they have watchman disabled.

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