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

Re: gitk shows local uncommit changes after touch file + reload

From
Philip Oakley <philipoakley@iee.org>
Date
Jan 7, 2019, 17:41 UTC
Message-ID
<2666a093-f9a5-782e-40b3-0cfbce8fe2a3@iee.org>
In-Reply-To
<CAPbeDCm5hjq06fbs=SUPR1rm3bD3GJvifZovP1d-Xd=01JfpYQ@mail.gmail.com>
On 06/01/2019 22:51, Jacob Kroon wrote:
Show 19 quoted lines
> Hi,
>
> Not sure if this has already been reported, but I observe this odd
> behaviour in gitk from master:
>
> git status
> gitk # everything looks good
> touch <file-under-version-control>
> gitk # gitk shows "local uncomitted changes" on the file I touched
> git status
> gitk # gitk is back to normal again, showing no local uncommitted changes
>
> The issue has been discussed on stackoverflow here:
> https://stackoverflow.com/questions/49990403/after-tar-untar-of-git-repo-gitk-shows-local-uncommitted-changes-not-checked
>
> Any chance gitk could be changed to so that it doesn't display the
> "local uncommitted changes" blob in this case ?
>
> Regards Jacob

I believe this is doing the right thing (TM) at the level of investigation that gitk uses to determine the status of the files. In particular, Git uses the modified time stamp as a surrogate indication for detecting that the user has probably edited the file (it's been modified at time hhmmss, right?).

Now as I understand it, the full (without limiting options) git status command does go and check the content of anything that's potentially changed (but it can be costly), and at that point the status command simply updates its 'Index' record with the new mtime after noticing that nothing had really changed. Meanwhile, gitk, being a continuously running GUI avoids the overhead of the git status (though you can force it) and does report the mtime change as being a potential file modification.

There is a separate discussion on the git users forum regarding the compatibility with other tools that has a similar root cause in the use and abuse of mtime as a canary for modification, given that the Git repo storage does not record any file times, so will get a (moderately) arbitrary mtime & ctime when checked out.

-- 
Philip
Previous: Jacob KroonNext: Jacob Kroon
Message 2 of 3 in “gitk shows local uncommit changes after touch file + reload”
  1. Jacob KroonJan 6, 2019
  2. Philip OakleyJan 7, 2019
  3. Jacob KroonJan 8, 2019

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.