{"thread":{"id":"34383","subject":"standarize mtime when git checkout","startedAt":"2013-07-08T21:39:09Z","lastAt":"2013-07-09T15:45:52Z","messageCount":4,"participants":["Rick Liu","Junio C Hamano","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"222865","messageId":"7D0754FFADBD2D4785C1D233C497C47B209AF2BC@SJEXCHMB06.corp.ad.broadcom.com","threadId":"34383","inReplyTo":null,"subject":"standarize mtime when git checkout","fromName":"Rick Liu","fromEmail":"rickliu@broadcom.com","sentAt":"2013-07-08T21:39:09Z","receivedAt":"2013-07-08T21:39:09Z","isPatch":false,"sender":{"key":"rickliu@broadcom.com","avatar":null},"body":"Hi,\n\nCurrently when doing \"git checkout\" (either for a branch or a tag),\nif the file doesn't exist before,\nthe file will be created using current datetime.\n\nThis causes problem while trying to tar the git repository source files (excluding .git folder).\nThe tar binary can be different \neven all of file contents are the same (eg. from the same GIT commit)\nbecause the mtime for the files might be different due to different \"git checkout\" time.\n\neg:\nUser A checkout the commit at time A and then tarball the folder.\nUser B checkout the same commit as time B and then tarball the folder.\nThe result tarball are binary different \neven though all of tarball contents are the same \nexcept the mtime for each file.\n\n\nCan we use GIT's commit time as the mtime for all of files/folders when we do \"git checkout\"?\n\n\nRick\n"},{"id":"222867","messageId":"7vobacyajq.fsf@alter.siamese.dyndns.org","threadId":"34383","inReplyTo":"7D0754FFADBD2D4785C1D233C497C47B209AF2BC@SJEXCHMB06.corp.ad.broadcom.com","subject":"Re: standarize mtime when git checkout","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-08T22:03:05Z","receivedAt":"2013-07-08T22:03:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Rick Liu\" <rickliu@broadcom.com> writes:\n\n> Can we use GIT's commit time as the mtime for all of files/folders when we do \"git checkout\"?\n\nNo.  That will screw up common practice of build based on file\ntimestamps (e.g. make).\n\nYou may be interested in \"git archive $commit\" which will set the file\ntimestamps that of the commit object.\n"},{"id":"222873","messageId":"51DB8966.2060308@lsrfire.ath.cx","threadId":"34383","inReplyTo":"7D0754FFADBD2D4785C1D233C497C47B209AF2BC@SJEXCHMB06.corp.ad.broadcom.com","subject":"Re: standarize mtime when git checkout","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2013-07-09T03:54:14Z","receivedAt":"2013-07-09T03:54:14Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 08.07.2013 23:39, schrieb Rick Liu:\n> Hi,\n>\n> Currently when doing \"git checkout\" (either for a branch or a tag),\n> if the file doesn't exist before,\n> the file will be created using current datetime.\n>\n> This causes problem while trying to tar the git repository source files (excluding .git folder).\n> The tar binary can be different\n> even all of file contents are the same (eg. from the same GIT commit)\n> because the mtime for the files might be different due to different \"git checkout\" time.\n>\n> eg:\n> User A checkout the commit at time A and then tarball the folder.\n> User B checkout the same commit as time B and then tarball the folder.\n> The result tarball are binary different\n> even though all of tarball contents are the same\n> except the mtime for each file.\n>\n>\n> Can we use GIT's commit time as the mtime for all of files/folders when we do \"git checkout\"?\n\nThat would break tools like make which rely on a files mtime to build \nthem.  They wouldn't be able to detect switching between source file \nversions that are older than the latest build.\n\nYou can use \"git archive\" to create tar files in which all entries have \ntheir mtime set to the commit time.  Such archives only contain tracked \n(committed) files, though.  And different versions of git can create \nslightly different archives, but such changes have been rare.\n\nRené\n"},{"id":"222932","messageId":"7D0754FFADBD2D4785C1D233C497C47B209B07D1@SJEXCHMB06.corp.ad.broadcom.com","threadId":"34383","inReplyTo":"51DB8966.2060308@lsrfire.ath.cx","subject":"RE: standarize mtime when git checkout","fromName":"Rick Liu","fromEmail":"rickliu@broadcom.com","sentAt":"2013-07-09T15:45:52Z","receivedAt":"2013-07-09T15:45:52Z","isPatch":false,"sender":{"key":"rickliu@broadcom.com","avatar":null},"body":"Thanks René~\nI'll use \"git archive\" command to create the tarball.\n\nRick\n\n-----Original Message-----\nFrom: René Scharfe [mailto:rene.scharfe@lsrfire.ath.cx] \nSent: Monday, July 08, 2013 8:54 PM\nTo: Rick Liu\nCc: git@vger.kernel.org\nSubject: Re: standarize mtime when git checkout\n\nAm 08.07.2013 23:39, schrieb Rick Liu:\n> Hi,\n>\n> Currently when doing \"git checkout\" (either for a branch or a tag),\n> if the file doesn't exist before,\n> the file will be created using current datetime.\n>\n> This causes problem while trying to tar the git repository source files (excluding .git folder).\n> The tar binary can be different\n> even all of file contents are the same (eg. from the same GIT commit)\n> because the mtime for the files might be different due to different \"git checkout\" time.\n>\n> eg:\n> User A checkout the commit at time A and then tarball the folder.\n> User B checkout the same commit as time B and then tarball the folder.\n> The result tarball are binary different\n> even though all of tarball contents are the same\n> except the mtime for each file.\n>\n>\n> Can we use GIT's commit time as the mtime for all of files/folders when we do \"git checkout\"?\n\nThat would break tools like make which rely on a files mtime to build \nthem.  They wouldn't be able to detect switching between source file \nversions that are older than the latest build.\n\nYou can use \"git archive\" to create tar files in which all entries have \ntheir mtime set to the commit time.  Such archives only contain tracked \n(committed) files, though.  And different versions of git can create \nslightly different archives, but such changes have been rare.\n\nRené\n"}]}