Subject: [BUG REPORT] fsmonitor and core.untrackedCache combination causes inaccurate git status
# What did you do before the bug happened? (Steps to reproduce your issue)
## Setup
git clone https://github.com/git/git.git
cd git
git config core.fsmonitor true
git config core.untrackedCache true
git config alias.fetch-bug '!git -C "$(pwd)" fetch'
wt1=$(mktemp -d)
git worktree add "$wt1" -b test
cd "$wt1"
## Worktree steps
git fsmonitor--daemon stop
git fetch-bug
touch foo.txt
git status
touch bar.txt
git status
# What did you expect to happen? (Expected behavior)
Expected bar.txt file to appear as an untracked file
# What happened instead? (Actual behavior)
bar.txt did not appear as an untracked file or in the status output
at all
# What's different between what you expected and what actually happened?
git status did not accurately reflect the state of the worktree
# Anything else you want to add:
The worktree seems to remain in a bug prone state even after
core.untrackedCache has been disabled, adding these steps shows
this:
git config core.untrackedCache false
# repeat "Worktree steps" (changing file names)
git config --unset core.untrackedCache
# repeat "Worktree steps" (changing file names) When a worktree is added and core.untrackedCache was not set to true
it does not reproduce the error:
git config --unset core.untrackedCache
wt2=$(mktemp -d)
git worktree add "$wt2" -b test-2
cd "$wt2"
# repeat "Worktree steps"[System Info]
git version:
git version 2.42.0.windows.2
cpu: x86_64
built from commit: 2f819d1670fff9a1818f63b6722e9959405378e3
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 22631
compiler info: gnuc: 13.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe
[Enabled Hooks]
post-checkout
post-commit
post-merge
pre-push