From: Tait <gnu...@t4...> - 2018-03-23 13:09:33
|
> On 22 March 2018 at 19:26, Ethan Merritt wrote: >> >> Here's a different idea. >> Does git gurantee to preserve the modification date attribute of files in >> the repository? Mojca Miklavec <moj...@gm...> said (on 2018/03/22): > I'm not sure what you are asking exactly, but: > > - Git doesn't remember original modification time of any file. ... > > When you switch back and forth between branches, the last modification > time of files on the disk will change, I think. > ... > If the only problem of "git describe" is support for out-of-source > builds, couldn't the Makefile simply do something like > > # remember current build-dir > cd source-dir > version=`git describe ...` > cd build-dir > echo $version > versionfile.txt > > (consider this to be pseudo-code). ... As Mojca mentioned, git does not preserve m-time. Make would not work properly unless git touched the changed files when switching branches or doing any other file-modifying operations. The underlying problem is that all the metadata is tracked in the .git directory, and you're asking a metadata question to be answered without having the .git directory. There is not any more a (somewhat) redundant file within the repository that also tracks metadata. If building in a different directory from the source, setting the GIT_DIR environment variable will allow git commands, including git-describe, to work. But if there is no .git directory at all, all the metadata has been stripped and it can't be recovered anymore unless some action was taken to preserve it before stripping it away. |