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

Re: Git doesn't detect change, if file modification time is restored to original one

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 23, 2015, 14:17 UTC
Message-ID
<ae5d01d5685d9db4cedcada1ce58f71d@www.dscho.org>
In-Reply-To
<CABEDGg8zixeab-CsviAU-fNE1Jmi0ZWbN6=e6Q+-XK3eFv6djA@mail.gmail.com>
Hi,
On 2015-07-23 09:29, Konrád Lőrinczi wrote:
> I wrote a search & replace perl script, which recursively searches
> files and replaces text in them. After replace, it restores original
> modification time (mtime) of file.
Since this is almost identical to https://github.com/msysgit/git/issues/312#issuecomment-124030520 I assume that you wrote that.
In my answer on the (already closed) GitHub ticket, I wrote this:
-- snipsnap --
    I wrote a search & replace perl script, which recursively searches
    files and replaces text in them. After replace, it restores original
    modification time (mtime) of file.
By this "restoring" of the original modification time you broke the contract: the mtime should reflect the time of the latest change. You replaced something, i.e. changed the file contents. Git expects the mtime to be adjusted in that case. By painstakingly faking it back to its original value you essentially told Git: don't worry, this file has not changed since you last saw it.
There is nothing Git can do to outguess you when you go out of your way to break the most fundamental promise of the mtime value.
Previous: Junio C Hamano
Message 7 of 7 in “Git doesn't detect change, if file modification time is restored to original one”
  1. Konrád LőrincziJul 23, 2015
  2. Sebastian SchuberthJul 23, 2015
  3. Konrád LőrincziJul 23, 2015
  4. Konstantin KhomoutovJul 23, 2015
  5. Karsten BleesJul 23, 2015
  6. Junio C HamanoJul 23, 2015
  7. Johannes SchindelinJul 23, 2015

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.