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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]