mtime is not restored after --autostash

Jos van den Oever <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
Dear git developers,

When git pull, merge, and rebase are used with --autostash and modify 
the current working directory, the mtime of files that are restored 
(stash apply) are set to the current time, even when the files have not 
changed.

In my understanding, git usually does nothing to the mtime of files so 
their mtime is set to the current time when they are written instead of 
e.g. the mtime of the commit date that is checked out. This ensures that 
build systems will run actions for which the changed file is an input.

When using --autostash there is the opportunity to restore the mtime 
that the dirty file had before the git command. This can save a lot of 
work for the build system.

There is another use case where restoring the mtime is useful: using git 
for unattended syncing of files. A system that checks in files 
automatically, after a cooling off period, could use the mtime as the 
author date of the commit. If --autostash changes the mtime, that date 
is wrong. Such a system could work around this by keeping track of the 
mtimes of dirty and new files and restoring them itself instead of 
relying on --autostash to do so.

Best regards,
Jos van den Oever
OpenPGP_signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEE0MfAiO/ptRjCuDpiO2+1ncoqSBUFAmp+BrQACgkQO2+1ncoq
SBW9Mgf+IDPiVTaw9QMzQsbfxFWorOaR2jJIYxikoUvXBQNn98uwKgU482wk/UbV
i3M51w9/XZs3/qLhXxo4BSuihxBiuoG7hwA5FTigf+8oYx0ev4T2XysFuXm08Bub
OPa8u0MKPI29IWQ5hkD3Da5UevbBDZenqLE2f4FdufFf9H+UgkK+iJYtLEhEwKdX
HkOZTOHPviItdCofMc/u8GXPEXQYAXJlloHYzRCTO5SMiICz7Eye57q20BaKrHKs
R2rgwZGHwh46DKf9qmbT8oAm9NDgtbUPTDfYhYVgMWGb1u7ILIhfEMT4fix8CLjz
XiKSRe6cz3K2OSZqnRGXIsQM2mwqeQ==
=fREa
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.