{"thread":{"id":"27590","subject":"Reverting/cheout files with old modification date","startedAt":"2011-06-09T07:09:47Z","lastAt":"2011-06-10T07:17:07Z","messageCount":2,"participants":["Peter Pientka","Fabrizio Chiarello"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"169736","messageId":"loom.20110609T090306-164@post.gmane.org","threadId":"27590","inReplyTo":null,"subject":"Reverting/cheout files with old modification date","fromName":"Peter Pientka","fromEmail":"p.pientka@gmail.com","sentAt":"2011-06-09T07:09:47Z","receivedAt":"2011-06-09T07:09:47Z","isPatch":false,"sender":{"key":"p.pientka@gmail.com","avatar":null},"body":"Hi,\nIs any way to revert/checkout some files from reposotory with old modification\ndate(file parameter). Now, while I revert/checkout some file, modification date\nof file is set to current date and time.\n\nCurrently I`m using git version 1.7.4.msysgit.0 \n\nThanks for reply\n"},{"id":"169835","messageId":"20110610071707.GA4715@hydrogen.black.hole","threadId":"27590","inReplyTo":"loom.20110609T090306-164@post.gmane.org","subject":"Re: Reverting/cheout files with old modification date","fromName":"Fabrizio Chiarello","fromEmail":"fabrizio.chiarello@ieee.org","sentAt":"2011-06-10T07:17:07Z","receivedAt":"2011-06-10T07:17:07Z","isPatch":false,"sender":{"key":"fabrizio.chiarello@ieee.org","avatar":null},"body":"On Thu, Jun 09, 2011 at 07:09:47AM +0000, Peter Pientka wrote:\n> Hi,\n> Is any way to revert/checkout some files from reposotory with old modification\n> date(file parameter). Now, while I revert/checkout some file, modification date\n> of file is set to current date and time.\n> \n\nI use this hook. On checkout it sets the mtime of all the files to\nthe date of the last commit touching them.\n\n===== .git/hooks/post-checkout\n\n#!/bin/sh\n\nfor f in `git ls-tree --name-only -r HEAD`; do\n    mtime=`git log -n1 --date=iso --pretty=%ai -- $f`\n    touch -m -d \"$mtime\" $f\ndone\n\n=====\n\n\n-- \nFabrizio Chiarello <fabrizio.chiarello@ieee.org>\n\nYou ask: what is the meaning or purpose of life? I can only answer with\nanother question: do you think we are wise enough to read God's mind?\n  -- Freeman Dyson\n"}]}