{"thread":{"id":"9366","subject":"Forcing rewrite of files in working tree","startedAt":"2007-08-03T12:45:46Z","lastAt":"2007-08-03T19:55:56Z","messageCount":4,"participants":["Andy Parkins","Rogan Dawes","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"49587","messageId":"200708031345.47127.andyparkins@gmail.com","threadId":"9366","inReplyTo":null,"subject":"Forcing rewrite of files in working tree","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-08-03T12:45:46Z","receivedAt":"2007-08-03T12:45:46Z","isPatch":false,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"Hello,\n\nI want to write a little recipe in a Makefile that ensures the $Id$ field in a \nseries of text files is correct.  In case it's relevant, I'm including a load \nof asciidoc files as subsections into one master file; each file has a $Id$ \nfield in the header, which very nicely prints out at the start of each \nsection.  However, the $Id$ field is only written on checkout (not on checkin \nfor fairly obvious reasons).  That means that for any files I've changed, the \n$Id$ is wrong.  Before I generate output using ASCIIdoc I'd like to ensure \nthe $Id$ is correct.\n\nHow do I do it?\n\nThe only method I've found is to delete the file in the work tree then do \ngit-checkout again.  Even with -f, if the file is not changed git doesn't \nperform a checkout again, so git-checkout -f is not sufficient.  I assume I \ncan do what I want with some clever plumbing, but I don't know any \nplumbing. :-)\n\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"49592","messageId":"46B3268C.7060707@dawes.za.net","threadId":"9366","inReplyTo":"200708031345.47127.andyparkins@gmail.com","subject":"Re: Forcing rewrite of files in working tree","fromName":"Rogan Dawes","fromEmail":"lists@dawes.za.net","sentAt":"2007-08-03T12:58:52Z","receivedAt":"2007-08-03T12:58:52Z","isPatch":false,"sender":{"key":"lists@dawes.za.net","avatar":null},"body":"Andy Parkins wrote:\n> Hello,\n> \n> I want to write a little recipe in a Makefile that ensures the $Id$ field in a \n> series of text files is correct.  In case it's relevant, I'm including a load \n> of asciidoc files as subsections into one master file; each file has a $Id$ \n> field in the header, which very nicely prints out at the start of each \n> section.  However, the $Id$ field is only written on checkout (not on checkin \n> for fairly obvious reasons).  That means that for any files I've changed, the \n> $Id$ is wrong.  Before I generate output using ASCIIdoc I'd like to ensure \n> the $Id$ is correct.\n> \n> How do I do it?\n> \n> The only method I've found is to delete the file in the work tree then do \n> git-checkout again.  Even with -f, if the file is not changed git doesn't \n> perform a checkout again, so git-checkout -f is not sufficient.  I assume I \n> can do what I want with some clever plumbing, but I don't know any \n> plumbing. :-)\n> \n> Andy\n\n$ git reset --hard\n\n?\n\nRogan\n"},{"id":"49599","messageId":"200708031439.29721.andyparkins@gmail.com","threadId":"9366","inReplyTo":"46B3268C.7060707@dawes.za.net","subject":"Re: Forcing rewrite of files in working tree","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-08-03T13:39:28Z","receivedAt":"2007-08-03T13:39:28Z","isPatch":false,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2007 August 03, Rogan Dawes wrote:\n\n> > The only method I've found is to delete the file in the work tree then do\n> > git-checkout again.  Even with -f, if the file is not changed git doesn't\n> > perform a checkout again, so git-checkout -f is not sufficient.  I assume\n> > I can do what I want with some clever plumbing, but I don't know any\n> > plumbing. :-)\n>\n> $ git reset --hard\n\nI think that that suffers the same as \"git-checkout -f\"; if it doesn't see \nchanges then it doesn't reread.  Also, it's not possible to do per-file:\n\n$ git reset --hard HEAD somefile.txt\nCannot do partial --hard reset.\n\nWhich is a necessity really; I don't want to accidentally overwrite work \nthat's not yet checked in in the rest of the tree.\n\nIs git-checkout-index the thing I'm looking for?  I'm wondering if the \"-n\" \nswitch is the trick?\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"49621","messageId":"alpine.LFD.0.999.0708031251130.8184@woody.linux-foundation.org","threadId":"9366","inReplyTo":"200708031345.47127.andyparkins@gmail.com","subject":"Re: Forcing rewrite of files in working tree","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-08-03T19:55:56Z","receivedAt":"2007-08-03T19:55:56Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 3 Aug 2007, Andy Parkins wrote:\n> \n> I want to write a little recipe in a Makefile that ensures the $Id$ field in a \n> series of text files is correct.  In case it's relevant, I'm including a load \n> of asciidoc files as subsections into one master file; each file has a $Id$ \n> field in the header, which very nicely prints out at the start of each \n> section.  However, the $Id$ field is only written on checkout (not on checkin \n> for fairly obvious reasons).  That means that for any files I've changed, the \n> $Id$ is wrong.  Before I generate output using ASCIIdoc I'd like to ensure \n> the $Id$ is correct.\n> \n> How do I do it?\n\nSomething like\n\n\tgit read-tree HEAD\n\tgit checkout -f\n\nshould do it.\n\nThe read-tree basically invalidated the index, by forcing it to the HEAD \ntree (and *without* doing a merge with the old index, so it doesn't get \nany of the size/date/inode fields right). And at that point, git thinks \nthat all files are stale, so \"git checkout -f\" will force the checkout for \nall of them.\n\nI'm sure you can do it other ways too, but that's the \"obvious\" one.\n\n\t\t\tLinus\n"}]}