git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: git@vger.kernel.org
Subject: Re: Setting file timestamps to commit time (git-checkout)
Date: Tue, 10 Dec 2013 20:02:29 +0100	[thread overview]
Message-ID: <87bo0olebe.fsf@igel.home> (raw)
In-Reply-To: <20131210083531.GB4087@linux.vnet.ibm.com> (Dominik Vogt's message of "Tue, 10 Dec 2013 09:35:31 +0100")

Dominik Vogt <vogt@linux.vnet.ibm.com> writes:

> The second best approach I could think of is to stamp files with the
> timestamp of the last commit that touched that, but I guess that is
> not a cheap operation either.

I'm using this script for this:

#!/bin/sh
git log --name-only --format=format:%n%ct -- "$@" |
perl -e 'my $do_date = 0; chomp(my $cdup = `git rev-parse --show-cdup`);
    while (<>) {
	chomp;
	if ($do_date) {
	    next if ($_ eq "");
	    die "Unexpected $_\n" unless /^[0-9]+$/;
	    $d = $_;
	    $do_date = 0;
	} elsif ($_ eq "") {
	    $do_date = 1;
	} elsif (!defined($seen{$_})) {
	    $seen{$_} = 1;
 	    utime $d, $d, "$cdup$_";
 	}
    }'

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2013-12-10 19:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09 11:25 Setting file timestamps to commit time (git-checkout) Dominik Vogt
2013-12-09 20:35 ` Junio C Hamano
2013-12-10  8:35   ` Dominik Vogt
2013-12-10 19:02     ` Andreas Schwab [this message]
2013-12-11  7:37       ` Dominik Vogt
2013-12-11  1:39     ` Constantine A. Murenin
2013-12-09 20:48 ` Jonathan Nieder
2013-12-10  8:46   ` Dominik Vogt
2013-12-10 10:34     ` Duy Nguyen
2013-12-11  1:08       ` Jonathan Nieder
2013-12-11  1:01     ` Jonathan Nieder

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=87bo0olebe.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=git@vger.kernel.org \
    /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).