git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Correcting timestamps when importing archives to git

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 26, 2008, 12:17 UTC
Message-ID
<alpine.LSU.1.00.0802261215171.17164@racer.site>
In-Reply-To
<47C3FBC4.4030206@dgreaves.com>
Hi,
On Tue, 26 Feb 2008, David Greaves wrote:
Show 31 quoted lines
> 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

Previous: David GreavesNext: David Greaves
Message 2 of 3 in “Correcting timestamps when importing archives to git”
  1. David GreavesFeb 26, 2008
  2. Johannes SchindelinFeb 26, 2008
  3. David GreavesFeb 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.