Correcting timestamps when importing archives to git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux