All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Greaves <david@dgreaves.com>
To: git@vger.kernel.org
Subject: Correcting timestamps when importing archives to git
Date: Tue, 26 Feb 2008 11:45:08 +0000	[thread overview]
Message-ID: <47C3FBC4.4030206@dgreaves.com> (raw)

Hi

I recently converted a set of patches to a git repository.

In order to use the correct timestamps my script used a 'faketime' solution I
found here:
  http://www.code-wizards.com/projects/libfaketime/

I used a perl subroutine that takes a time (obtained by stat()ing the original
patch or looking in logs) and then the normal 'system()' args.

sub faketime_system {
    my $time=shift;

$ENV{"LD_PRELOAD"}="/everything/devel/faketime/libfaketime-0.6/libfaketime.so.1";
    $ENV{"FAKETIME_FMT"}='%s';
    $ENV{'FAKETIME'}=$time;
    system @_;
    $ENV{"LD_PRELOAD"}="";
}


so:
	$time=(stat("$tarfile"))[9];
	faketime_system ($time, "tar xfj $tarfile");

or:
    $time=(stat("$patchfile"))[9];
    faketime_system ($time, "zcat $patchfile | patch -f -p1");
    faketime_system ($time, "git add .");

HTH someone else...

David

             reply	other threads:[~2008-02-26 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 11:45 David Greaves [this message]
2008-02-26 12:17 ` Correcting timestamps when importing archives to git Johannes Schindelin
2008-02-26 12:55   ` David Greaves

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=47C3FBC4.4030206@dgreaves.com \
    --to=david@dgreaves.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.