{"thread":{"id":"12326","subject":"Correcting timestamps when importing archives to git","startedAt":"2008-02-26T11:45:08Z","lastAt":"2008-02-26T12:55:07Z","messageCount":3,"participants":["David Greaves","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"69979","messageId":"47C3FBC4.4030206@dgreaves.com","threadId":"12326","inReplyTo":null,"subject":"Correcting timestamps when importing archives to git","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2008-02-26T11:45:08Z","receivedAt":"2008-02-26T11:45:08Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Hi\n\nI recently converted a set of patches to a git repository.\n\nIn order to use the correct timestamps my script used a 'faketime' solution I\nfound here:\n  http://www.code-wizards.com/projects/libfaketime/\n\nI used a perl subroutine that takes a time (obtained by stat()ing the original\npatch or looking in logs) and then the normal 'system()' args.\n\nsub faketime_system {\n    my $time=shift;\n\n$ENV{\"LD_PRELOAD\"}=\"/everything/devel/faketime/libfaketime-0.6/libfaketime.so.1\";\n    $ENV{\"FAKETIME_FMT\"}='%s';\n    $ENV{'FAKETIME'}=$time;\n    system @_;\n    $ENV{\"LD_PRELOAD\"}=\"\";\n}\n\n\nso:\n\t$time=(stat(\"$tarfile\"))[9];\n\tfaketime_system ($time, \"tar xfj $tarfile\");\n\nor:\n    $time=(stat(\"$patchfile\"))[9];\n    faketime_system ($time, \"zcat $patchfile | patch -f -p1\");\n    faketime_system ($time, \"git add .\");\n\nHTH someone else...\n\nDavid\n"},{"id":"69981","messageId":"alpine.LSU.1.00.0802261215171.17164@racer.site","threadId":"12326","inReplyTo":"47C3FBC4.4030206@dgreaves.com","subject":"Re: Correcting timestamps when importing archives to git","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-26T12:17:35Z","receivedAt":"2008-02-26T12:17:35Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 26 Feb 2008, David Greaves wrote:\n\n> I recently converted a set of patches to a git repository.\n> \n> In order to use the correct timestamps my script used a 'faketime' \n> solution I found here:\n>\n>   http://www.code-wizards.com/projects/libfaketime/\n> \n> I used a perl subroutine that takes a time (obtained by stat()ing the \n> original patch or looking in logs) and then the normal 'system()' args.\n> \n> sub faketime_system {\n>     my $time=shift;\n> \n> $ENV{\"LD_PRELOAD\"}=\"/everything/devel/faketime/libfaketime-0.6/libfaketime.so.1\";\n>     $ENV{\"FAKETIME_FMT\"}='%s';\n>     $ENV{'FAKETIME'}=$time;\n>     system @_;\n>     $ENV{\"LD_PRELOAD\"}=\"\";\n> }\n> \n> \n> so:\n> \t$time=(stat(\"$tarfile\"))[9];\n> \tfaketime_system ($time, \"tar xfj $tarfile\");\n> \n> or:\n>     $time=(stat(\"$patchfile\"))[9];\n>     faketime_system ($time, \"zcat $patchfile | patch -f -p1\");\n>     faketime_system ($time, \"git add .\");\n> \n> HTH someone else...\n\nWow.  That is sure one of the most complicated ways to go about it.\n\nIMO GIT_AUTHOR_DATE and GIT_COMMITTER_DATE (mentioned in \nDocumentation/git.txt, and described in Documentation/git-commit-tree.txt) \nwould have been the tools to use.\n\nHth,\nDscho\n"},{"id":"69990","messageId":"47C40C2B.8040003@dgreaves.com","threadId":"12326","inReplyTo":"alpine.LSU.1.00.0802261215171.17164@racer.site","subject":"Re: Correcting timestamps when importing archives to git","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2008-02-26T12:55:07Z","receivedAt":"2008-02-26T12:55:07Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Johannes Schindelin wrote:\n> \n> Wow.  That is sure one of the most complicated ways to go about it.\nDepends. after checking the git pages for time arguments then spoofing the time\nis (was!) the most obvious way to do it IMO :)\nThereafter it took a few seconds to google faketime, download and implement.\n\n> IMO GIT_AUTHOR_DATE and GIT_COMMITTER_DATE (mentioned in \n> Documentation/git.txt, and described in Documentation/git-commit-tree.txt) \n> would have been the tools to use.\n\nIndeed - I forgot all about those - and I wrote the first versions of those\nfiles IIRC!\n\nThe variables are not written about much more and didn't show up when I was\ngoogling for managing git timestamps/dates. Maybe they will now.\n\nAnd - the whole point of the email was for the archives - so thanks for the\nreply and the reminder/better suggestion.\n\nDavid\n"}]}