Preserving timestamps with git
Olaf TNSB
still.another.person at gmail.com
Fri May 28 00:49:13 CEST 2010
Hi Jakob,
Can you explain (or give a simple example) why you need the timestamps
to be "correct".
After moving to a versioned homedir (and getting my mind around what
that means) I've never worried about the revision time of my files. I
just knew they were either the most recent version or a particular
version for a particular reason.
I can understand the need for other metadata (file perms for .ssh for
example) but not file date. Perhaps I'm missing something huge that
will make my life easier...
Cheers,
Olaf
On 5/27/10, Jakob Voss <jakob.voss at gbv.de> wrote:
> Hi,
>
> I started to move the content of my home directory to git repositories
> and stumbled upon a difficult difference between rsync and git: git does
> not preserve timestamps. This makes sense for code-repositories but if I
> replicate my home directory I expect that modification times are not
> always set to the current time.
>
> I found this useful script (which I called 'git-utime') to set
> modifcation times to the timestamp of the commit which last touched a
> file. As far as I understand this is the best we have because git does
> not store the original timestamp when a file is commited (right?):
>
> https://git.wiki.kernel.org/index.php/ExampleScripts#Setting_the_timestamps_of_the_files_to_the_commit_timestamp_of_the_commit_which_last_touched_them
>
> I bet there is some hook to install the script to be called on every
> pull - I think of a .gitutime file like .gitignore that selects all
> files that should get their original timestamp. If some of you already
> have such a system please let me know!
>
> But git-utime is only one side of the process. How do I
>
> 1) reset the commit time of selected files in the repository to their
> last modification timestamp (for the files that I have already commited)
>
> 2) add and commit a set of files in a batch such that each commit has
> the timestamp of the last modification time of its file (for new files).
>
> Obviously each commit must be only one file. The commit message could
> just be "initial commit" or "initial commit at `date --rfc-3339=s`".
>
> Maybe by some additional git magic the .gitutime could be reused to give
> a warning if I try to add a new file that the normal way which would
> makes it impossible to preserve timestamp.
>
>
> How do you deal with timestamp of you files? I heard there are some
> hacks to even preserve file permissions but I'd prefer a simple solution
> first.
>
> Cheers,
> Jakob
>
> --
> Jakob Voß <jakob.voss at gbv.de>, skype: nichtich
> Verbundzentrale des GBV (VZG) / Common Library Network
> Platz der Goettinger Sieben 1, 37073 Göttingen, Germany
> +49 (0)551 39-10242, http://www.gbv.de
> _______________________________________________
> vcs-home mailing list
> vcs-home at lists.madduck.net
> http://lists.madduck.net/listinfo/vcs-home
>
--
Sent from my mobile device
More information about the vcs-home
mailing list