git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
JLJoni Lameter <jlameter@epic.com>
Date
May 9, 2024, 15:45 UTC
Message-ID
<DM6PR17MB215602138249E744ECFE4185A6E62@DM6PR17MB2156.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
Next: Joni Lameter
Message 1 of 2 in “[BUG REPORT] fsmonitor and core.untrackedCache combination causes inaccurate git status”
  1. Joni LameterMay 9, 2024
  2. Joni LameterJun 24, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.