* Correcting timestamps when importing archives to git
@ 2008-02-26 11:45 David Greaves
2008-02-26 12:17 ` Johannes Schindelin
0 siblings, 1 reply; 3+ messages in thread
From: David Greaves @ 2008-02-26 11:45 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Correcting timestamps when importing archives to git
2008-02-26 11:45 Correcting timestamps when importing archives to git David Greaves
@ 2008-02-26 12:17 ` Johannes Schindelin
2008-02-26 12:55 ` David Greaves
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2008-02-26 12:17 UTC (permalink / raw)
To: David Greaves; +Cc: git
Hi,
On Tue, 26 Feb 2008, David Greaves wrote:
> 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...
Wow. That is sure one of the most complicated ways to go about it.
IMO GIT_AUTHOR_DATE and GIT_COMMITTER_DATE (mentioned in
Documentation/git.txt, and described in Documentation/git-commit-tree.txt)
would have been the tools to use.
Hth,
Dscho
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Correcting timestamps when importing archives to git
2008-02-26 12:17 ` Johannes Schindelin
@ 2008-02-26 12:55 ` David Greaves
0 siblings, 0 replies; 3+ messages in thread
From: David Greaves @ 2008-02-26 12:55 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin wrote:
>
> Wow. That is sure one of the most complicated ways to go about it.
Depends. after checking the git pages for time arguments then spoofing the time
is (was!) the most obvious way to do it IMO :)
Thereafter it took a few seconds to google faketime, download and implement.
> IMO GIT_AUTHOR_DATE and GIT_COMMITTER_DATE (mentioned in
> Documentation/git.txt, and described in Documentation/git-commit-tree.txt)
> would have been the tools to use.
Indeed - I forgot all about those - and I wrote the first versions of those
files IIRC!
The variables are not written about much more and didn't show up when I was
googling for managing git timestamps/dates. Maybe they will now.
And - the whole point of the email was for the archives - so thanks for the
reply and the reminder/better suggestion.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-26 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-26 11:45 Correcting timestamps when importing archives to git David Greaves
2008-02-26 12:17 ` Johannes Schindelin
2008-02-26 12:55 ` David Greaves
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).