# [BUG REPORT] fsmonitor and core.untrackedCache combination causes inaccurate git status

2 messages from 2024-05-09 to 2024-06-24. Participants: Joni Lameter.
Thread: https://gitlist.dev/t/61444

## Joni Lameter, 2024-05-09 15:45

Subject: [BUG REPORT] fsmonitor and core.untrackedCache combination causes inaccurate git status
Message-ID: <DM6PR17MB215602138249E744ECFE4185A6E62@DM6PR17MB2156.namprd17.prod.outlook.com>
URL: https://gitlist.dev/e/DM6PR17MB215602138249E744ECFE4185A6E62%40DM6PR17MB2156.namprd17.prod.outlook.com

```
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

```

## Joni Lameter, 2024-06-24 17:43

Subject: RE: [BUG REPORT] fsmonitor and core.untrackedCache combination causes inaccurate git status
Message-ID: <DM6PR17MB215638310B4E03A891C1CF8FA6D42@DM6PR17MB2156.namprd17.prod.outlook.com>
URL: https://gitlist.dev/e/DM6PR17MB215638310B4E03A891C1CF8FA6D42%40DM6PR17MB2156.namprd17.prod.outlook.com
In-Reply-To: <DM6PR17MB215602138249E744ECFE4185A6E62@DM6PR17MB2156.namprd17.prod.outlook.com>

```
I haven't heard back about this bug report. Is there any additional 
info that would be helpful here? Should I have reported this 
somewhere else?

```
