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

git status shows a different result depending on how fast a file is changed

From
DCDamien Cassou <damien@cassou.me>
Date
Aug 22, 2025, 15:10 UTC
Message-ID
<m0o6s7xuh3.fsf@cassou.me>
Hi,

The attached script has a commented "sleep 1s" line in the middle. If it is commented, "git status" at the end will not list your last changes to foo.txt (which I find a weird behavior). If you uncomment the line, "git status" will see your changes.

My global Git configuration file ~/.config/git/config only contains settings for user.name and user.email. I can reproduce both on macOS and GNU/Linux. My Git version is 2.50.1.

I realize that if the date of foo.txt at the end of the script is changed then "git status" will always detect the change. I also realize that if the size of foo.txt changes then "git status" will always detect the change.

Can somebody explain me how the "delay 1s" command can change the behavior of "git status"? If you know where in the C code this behavior is implemented, I'm interested as well.

Thank you very much
-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
Next: Damien Cassou
Message 1 of 2 in “git status shows a different result depending on how fast a file is changed”
  1. Damien CassouAug 22, 2025
  2. Damien CassouAug 26, 2025

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.