git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabrizio Chiarello <fabrizio.chiarello@ieee.org>
To: Peter Pientka <p.pientka@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Reverting/cheout files with old modification date
Date: Fri, 10 Jun 2011 09:17:07 +0200	[thread overview]
Message-ID: <20110610071707.GA4715@hydrogen.black.hole> (raw)
In-Reply-To: <loom.20110609T090306-164@post.gmane.org>

On Thu, Jun 09, 2011 at 07:09:47AM +0000, Peter Pientka wrote:
> Hi,
> Is any way to revert/checkout some files from reposotory with old modification
> date(file parameter). Now, while I revert/checkout some file, modification date
> of file is set to current date and time.
> 

I use this hook. On checkout it sets the mtime of all the files to
the date of the last commit touching them.

===== .git/hooks/post-checkout

#!/bin/sh

for f in `git ls-tree --name-only -r HEAD`; do
    mtime=`git log -n1 --date=iso --pretty=%ai -- $f`
    touch -m -d "$mtime" $f
done

=====


-- 
Fabrizio Chiarello <fabrizio.chiarello@ieee.org>

You ask: what is the meaning or purpose of life? I can only answer with
another question: do you think we are wise enough to read God's mind?
  -- Freeman Dyson

      reply	other threads:[~2011-06-10  7:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  7:09 Reverting/cheout files with old modification date Peter Pientka
2011-06-10  7:17 ` Fabrizio Chiarello [this message]

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=20110610071707.GA4715@hydrogen.black.hole \
    --to=fabrizio.chiarello@ieee.org \
    --cc=git@vger.kernel.org \
    --cc=p.pientka@gmail.com \
    /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).