{"thread":{"id":"27012","subject":"Re: git: \"git stash\" changes owners and permissions","startedAt":"2011-04-06T20:52:12Z","lastAt":"2011-04-06T22:12:05Z","messageCount":3,"participants":["Jonathan Nieder","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"165312","messageId":"20110406205212.GC1922@elie","threadId":"27012","inReplyTo":"20110406200640.GF12557@sym.noone.org","subject":"Re: git: \"git stash\" changes owners and permissions","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-06T20:52:12Z","receivedAt":"2011-04-06T20:52:12Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(moving to the git list)\nAxel Beckert wrote[0]:\n\n> I should probably look again for plugins or hooks taking care of file\n> meta-data, but the last time I looked for such a thing, the stuff I\n> found wasn't very promising. Any tips and hints are appreciated.\n\nEverything I know about metadata tracking is at [1].  Which is to say,\nI don't know much.  I believe the state of the art involves saving\nscripts to store metadata along with the repository, as in Dan\nJacobson's git-cache-meta script and etckeeper's pre-commit.d\ndirectory[2]. [3]\n\nAs mentioned before, I don't advise using git to deploy changed files.\nIt will change them in the wrong order and creates windows when they're\nnot present.  Perhaps a procedure like the following can work?\n\n\tcd /root; (umask 077 && mkdir tmp); cd tmp\n\tgit clone /etc/interesting-subdir\n\tcd interesting-subdir\n\t... hack hack hack ...\n\tgit commit\n\t... is it really ok?  check in whatever way I know ...\n\n\t# yes, it's okay.\n\tgit push /etc/interesting-subdir/.git HEAD:refs/remotes/jrn/proposed\n\tcd /etc/interesting-subdir\n\tgit diff jrn/proposed;\t# one final check\n\n\t# deploy.\n\trsync -a --exclude='.git' /root/tmp/interesting-subdir/ .\n\tgit reset jrn/proposed\n\tgit diff;\t# should show no changes.\n\n\t# clean up.\n\trm -r /root/tmp/interesting-subdir\n\trmdir /root/tmp\n\nPlease keep us posted --- it would be nice to put whatever workflow\nyou end up with in a howto for distribution with git.\n\nRegards,\nJonathan\n\n[0] http://bugs.debian.org/621090\n[1] https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools#Backups.2C_metadata.2C_and_large_files\n[2] http://git.kitenet.net/?p=etckeeper.git;a=tree;f=pre-commit.d;hb=master\n[3] It is as though we were in the days of shar as an archival format.\nIn the long term I will be happier if something pleasant based on\n.gitattributes appears. ;-)\n"},{"id":"165318","messageId":"7voc4jgig7.fsf@alter.siamese.dyndns.org","threadId":"27012","inReplyTo":"20110406205212.GC1922@elie","subject":"Re: git: \"git stash\" changes owners and permissions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-06T21:48:08Z","receivedAt":"2011-04-06T21:48:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> ...\n> As mentioned before, I don't advise using git to deploy changed files.\n> It will change them in the wrong order and creates windows when they're\n> not present.  Perhaps a procedure like the following can work?\n>\n> \tcd /root; (umask 077 && mkdir tmp); cd tmp\n> \tgit clone /etc/interesting-subdir\n>...\n> \t# deploy.\n> \trsync -a --exclude='.git' /root/tmp/interesting-subdir/ .\n> \tgit reset jrn/proposed\n> \tgit diff;\t# should show no changes.\n\n\nHow does this \"rsync\" solve \"the wrong order\" and \"creates windows\"\nproblems?  It will update the paths in the order rsync happens to discover\nand there is a wondow between the time the first path is updated and the\nwhole directory gets finally in sync.\n\nIf you truly want an atomicity, you can make /etc/interesting-subdir a\nsymbolic link that points to either interesting-subdir-{0,1}, do the above\nprocedure of yours against interesting-subdir-0 (or 1) that is currently\nnot pointed by the symbolic link, and when everything in that one is Ok,\natomically switch the symbolic link to point at it.\n"},{"id":"165319","messageId":"20110406221205.GB2894@elie","threadId":"27012","inReplyTo":"7voc4jgig7.fsf@alter.siamese.dyndns.org","subject":"Re: git: \"git stash\" changes owners and permissions","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-06T22:12:05Z","receivedAt":"2011-04-06T22:12:05Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> How does this \"rsync\" solve \"the wrong order\" and \"creates windows\"\n> problems?  It will update the paths in the order rsync happens to discover\n> and there is a wondow between the time the first path is updated and the\n> whole directory gets finally in sync.\n\nAll true.  It's a little better than \"git checkout\" because rsync\nwill stage files and then rename them into place rather than leaving\na window with files unlinked[1], but it is not much better.\n\nIn fact the rsync was a misleading placeholder.  What I really meant\nto convey is that this is not something \"git checkout\" and \"git reset\n--hard\" are designed to do, and that when this much control is needed,\nit can be easier to update files out-of-band.\n\n> If you truly want an atomicity, you can make /etc/interesting-subdir a\n> symbolic link that points to either interesting-subdir-{0,1}, do the above\n> procedure of yours against interesting-subdir-0 (or 1) that is currently\n> not pointed by the symbolic link, and when everything in that one is Ok,\n> atomically switch the symbolic link to point at it.\n\nTrue.  Though in practice, a little race might be considered ok. :)\n\nThanks for clarifying.\nJonathan\n\n[1] rsync with --files-from can update files in a specific order,\nwhich might be appropriate in some cases.\n"}]}