git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Peter Backes <rtc@helen.PLASMA.Xg8.DE>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: Git should preserve modification times at least on request
Date: Mon, 19 Feb 2018 20:22:19 -0500	[thread overview]
Message-ID: <20180220012219.GA9791@thunk.org> (raw)
In-Reply-To: <20180219220819.GA10466@helen.PLASMA.Xg8.DE>

On Mon, Feb 19, 2018 at 11:08:19PM +0100, Peter Backes wrote:
> Is thetre some existing code that could be used? I think I read 
> somewhere that git once did preserve mtimes, but that this code was 
> removed because of the build tool issues. Perhaps that code could 
> simply be put back in, and surrounded by conditions.

I don't believe that was ever true, because the mod times is simply
not *stored* anywhere.

You might want to consider trying to implement it as hook scripts
first, and see how well/poorly it works for you.  I do have a use
case, which is to maintain the timestamps for guilt (a quilt-like
patch management system which uses git).  At the moment I just use a
manual script, save-timestamps, which looks like this:

#!/bin/sh
stat -c "touch -d @%Y %n" * | sort -k 3 | grep -v "~$" | sort -k3 > timestamps

and then I just include the timestamps file in thhe commit.  When I
unpack the file elsewhere, I just run the command ". timestamps", or
if I am manually editing a single file, I might do:

	grep file-name-of-patch timestamps | sht

This works because the timestamps file has lines which look like
this:

touch -d @1519007593 jbd2-clarify-recovery-checksum-error-msg

I've been too lazy to automate this using a "pre-commit" and
"post-checkout" hook, but it *really* wouldn't be that hard.  Right
now it also only works for files in the top-level of the repo, which
is all I have in my guilt patch repo.  Making this work in a
multiple-directory environment is also left as an exercise to the
reader.  :-)

Cheers,

						- Ted

P.S.  Also left to the reader is making it work on legacy OS's like
Windows.  :-)

  reply	other threads:[~2018-02-20  1:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 21:22 Git should preserve modification times at least on request Peter Backes
2018-02-19 21:58 ` Johannes Schindelin
2018-02-19 22:08   ` Peter Backes
2018-02-20  1:22     ` Theodore Ts'o [this message]
2018-02-20 10:46     ` Johannes Schindelin
2018-02-20 11:53       ` Peter Backes
2018-02-20 21:05       ` Peter Backes
2018-02-20 22:32         ` Johannes Schindelin
2018-02-20 22:48           ` Peter Backes
2018-02-21 21:30             ` Phillip Wood
2018-02-19 22:37   ` Randall S. Becker
2018-02-19 23:22     ` Hilco Wijbenga
2018-02-20 16:42       ` Hilco Wijbenga
2018-02-20 21:16 ` Jeff King
2018-02-20 22:05   ` Peter Backes
2018-02-21  9:48     ` Jacob Keller
2018-02-20 23:40   ` Junio C Hamano
2018-02-21 21:03 ` Derek Fawcus
2018-02-21 21:33   ` Ævar Arnfjörð Bjarmason
2018-02-21 22:14     ` Peter Backes
2018-02-21 22:44       ` Ævar Arnfjörð Bjarmason
2018-02-21 23:12         ` Peter Backes
2018-02-21 23:58           ` Randall S. Becker
2018-02-22  2:05             ` 'Peter Backes'
2018-02-26 10:56               ` Andreas Krey
2018-02-26 11:04                 ` 'Peter Backes'
2018-02-22 23:24         ` Derek Fawcus
2018-02-23 12:28       ` Konstantin Khomoutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180220012219.GA9791@thunk.org \
    --to=tytso@mit.edu \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=rtc@helen.PLASMA.Xg8.DE \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).