{"thread":{"id":"393","subject":"More problems...","startedAt":"2005-04-29T16:01:27Z","lastAt":"2005-05-04T05:54:01Z","messageCount":24,"participants":["Russell King","Linus Torvalds","Petr Baudis","Ryan Anderson","Thomas Glanzmann","Junio C Hamano","Daniel Barkalow","Anton Altaparmakov","Dave Kleikamp","Andreas Gal"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"2138","messageId":"20050429170127.A30010@flint.arm.linux.org.uk","threadId":"393","inReplyTo":null,"subject":"More problems...","fromName":"Russell King","fromEmail":"rmk@arm.linux.org.uk","sentAt":"2005-04-29T16:01:27Z","receivedAt":"2005-04-29T16:01:27Z","isPatch":false,"sender":{"key":"rmk@arm.linux.org.uk","avatar":null},"body":"Ok.  cogito-0.8.\n\nrmk@dyn-67:[linux-2.6-rmk]:<1049> cg-update origin\n`../linux-2.6/.git/refs/heads/master' -> `.git/refs/heads/origin'\n`../linux-2.6/.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901' -> `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901'\ncp: cannot create link `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901': File exists\n`../linux-2.6/.git/objects/01/ca31cc7bfdd18d6f72288915021730442f386d' -> `.git/objects/01/ca31cc7bfdd18d6f72288915021730442f386d'\ncp: cannot create link `.git/objects/01/ca31cc7bfdd18d6f72288915021730442f386d': File exists\n`../linux-2.6/.git/objects/04/17820d15efac837a84f9ade46f56339016a282' -> `.git/objects/04/17820d15efac837a84f9ade46f56339016a282'\ncp: cannot create link `.git/objects/04/17820d15efac837a84f9ade46f56339016a282': File exists\n`../linux-2.6/.git/objects/07/da010b67d4d715b5e97dfb824eb70433776a20' -> `.git/objects/07/da010b67d4d715b5e97dfb824eb70433776a20'\ncp: cannot create link `.git/objects/07/da010b67d4d715b5e97dfb824eb70433776a20': File exists\n`../linux-2.6/.git/objects/07/5d3961a119e8f27294cd77193f8fee7908a521' -> `.git/objects/07/5d3961a119e8f27294cd77193f8fee7908a521'\n...\ncp: cannot create link `.git/objects/fc/1428905472a61e8e51057a4237acab5d8594d8': File exists\n`../linux-2.6/.git/objects/fc/373c483e62dc1bbc5c3915f2d3c795fb316ec5' -> `.git/objects/fc/373c483e62dc1bbc5c3915f2d3c795fb316ec5'\ncp: cannot create link `.git/objects/fc/373c483e62dc1bbc5c3915f2d3c795fb316ec5': File exists\n`../linux-2.6/.git/objects/ff/c3be3dff7e20e2ad5367fa8d6d0d2f0baa8a24' -> `.git/objects/ff/c3be3dff7e20e2ad5367fa8d6d0d2f0baa8a24'\ncp: cannot create link `.git/objects/ff/c3be3dff7e20e2ad5367fa8d6d0d2f0baa8a24': File exists\n`../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783' -> `.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783'\ncp: cannot create link `.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783': File exists\ncg-pull: rsync error\n\nrmk@dyn-67:[linux-2.6-rmk]:<1052> md5sum .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783 ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n194b70d0eed786807e14e97dd0a5ad8d  .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n194b70d0eed786807e14e97dd0a5ad8d  ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\nrmk@dyn-67:[linux-2.6-rmk]:<1053> vdir .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783 ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n-rw-rw-r--  1 rmk rmk 3070 Apr 28 10:43 .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n-rw-r--r--  1 rmk rmk 3070 Apr 29 16:50 ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n\nWhat seems to be happening is that I create changes in my tree, rsync\nthem out to kernel.org.  Linus pulls them into his tree.  I pull them\nback into my reference tree, and then try and update my working tree.\n\nBy that time, the object files in the reference tree appear to have\na newer timestamp than the corresponding ones in my local tree, and\ncp -lua fails.\n\nWhich means cogito fails to work for me...  Help.\n\n-- \nRussell King\n\n"},{"id":"2139","messageId":"20050429171205.B30010@flint.arm.linux.org.uk","threadId":"393","inReplyTo":"20050429170127.A30010@flint.arm.linux.org.uk","subject":"Re: More problems...","fromName":"Russell King","fromEmail":"rmk@arm.linux.org.uk","sentAt":"2005-04-29T16:12:05Z","receivedAt":"2005-04-29T16:12:05Z","isPatch":false,"sender":{"key":"rmk@arm.linux.org.uk","avatar":null},"body":"On Fri, Apr 29, 2005 at 05:01:27PM +0100, Russell King wrote:\n> Ok.  cogito-0.8.\n> \n> rmk@dyn-67:[linux-2.6-rmk]:<1049> cg-update origin\n> `../linux-2.6/.git/refs/heads/master' -> `.git/refs/heads/origin'\n> `../linux-2.6/.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901' -> `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901'\n> cp: cannot create link `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901': File exists\n> `../linux-2.6/.git/objects/01/ca31cc7bfdd18d6f72288915021730442f386d' -> `.git/objects/01/ca31cc7bfdd18d6f72288915021730442f386d'\n> cp: cannot create link `.git/objects/01/ca31cc7bfdd18d6f72288915021730442f386d': File exists\n> `../linux-2.6/.git/objects/04/17820d15efac837a84f9ade46f56339016a282' -> `.git/objects/04/17820d15efac837a84f9ade46f56339016a282'\n> cp: cannot create link `.git/objects/04/17820d15efac837a84f9ade46f56339016a282': File exists\n> `../linux-2.6/.git/objects/07/da010b67d4d715b5e97dfb824eb70433776a20' -> `.git/objects/07/da010b67d4d715b5e97dfb824eb70433776a20'\n> cp: cannot create link `.git/objects/07/da010b67d4d715b5e97dfb824eb70433776a20': File exists\n> `../linux-2.6/.git/objects/07/5d3961a119e8f27294cd77193f8fee7908a521' -> `.git/objects/07/5d3961a119e8f27294cd77193f8fee7908a521'\n> ...\n> cp: cannot create link `.git/objects/fc/1428905472a61e8e51057a4237acab5d8594d8': File exists\n> `../linux-2.6/.git/objects/fc/373c483e62dc1bbc5c3915f2d3c795fb316ec5' -> `.git/objects/fc/373c483e62dc1bbc5c3915f2d3c795fb316ec5'\n> cp: cannot create link `.git/objects/fc/373c483e62dc1bbc5c3915f2d3c795fb316ec5': File exists\n> `../linux-2.6/.git/objects/ff/c3be3dff7e20e2ad5367fa8d6d0d2f0baa8a24' -> `.git/objects/ff/c3be3dff7e20e2ad5367fa8d6d0d2f0baa8a24'\n> cp: cannot create link `.git/objects/ff/c3be3dff7e20e2ad5367fa8d6d0d2f0baa8a24': File exists\n> `../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783' -> `.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783'\n> cp: cannot create link `.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783': File exists\n> cg-pull: rsync error\n> \n> rmk@dyn-67:[linux-2.6-rmk]:<1052> md5sum .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783 ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n> 194b70d0eed786807e14e97dd0a5ad8d  .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n> 194b70d0eed786807e14e97dd0a5ad8d  ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n> rmk@dyn-67:[linux-2.6-rmk]:<1053> vdir .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783 ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n> -rw-rw-r--  1 rmk rmk 3070 Apr 28 10:43 .git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n> -rw-r--r--  1 rmk rmk 3070 Apr 29 16:50 ../linux-2.6/.git/objects/ff/8b49966a9f6ed23f6489bb986de87a14d4b783\n> \n> What seems to be happening is that I create changes in my tree, rsync\n> them out to kernel.org.  Linus pulls them into his tree.  I pull them\n> back into my reference tree, and then try and update my working tree.\n> \n> By that time, the object files in the reference tree appear to have\n> a newer timestamp than the corresponding ones in my local tree, and\n> cp -lua fails.\n> \n> Which means cogito fails to work for me...  Help.\n\nI've worked around it by doing:\n\n$ rm -rf .git/objects/*\n$ cg-update origin\n\nNot particularly nice, but very necessary, and apparantly the only\nway to get this to work.  Grumble.  Why am I seemingly the only one\nrunning into all these blocking problems.\n\n-- \nRussell King\n\n"},{"id":"2148","messageId":"Pine.LNX.4.58.0504291049290.18901@ppc970.osdl.org","threadId":"393","inReplyTo":"20050429171205.B30010@flint.arm.linux.org.uk","subject":"Re: More problems...","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-04-29T17:51:08Z","receivedAt":"2005-04-29T17:51:08Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 29 Apr 2005, Russell King wrote:\n> \n> Not particularly nice, but very necessary, and apparantly the only\n> way to get this to work.  Grumble.  Why am I seemingly the only one\n> running into all these blocking problems.\n\nWell, I suspect not a lot of people are actually using cogito for kernel \nstuff.\n\nI still use my old \"git-pull-script\" to update stuff. I know how it works, \nand it does at least these things right (as long as \"merge-base\" works \nright, of course - which so far it has for me since the re-write).\n\n\t\tLinus\n"},{"id":"2152","messageId":"20050429182708.GB14202@pasky.ji.cz","threadId":"393","inReplyTo":"20050429170127.A30010@flint.arm.linux.org.uk","subject":"Re: More problems...","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-29T18:27:08Z","receivedAt":"2005-04-29T18:27:08Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Apr 29, 2005 at 06:01:27PM CEST, I got a letter\nwhere Russell King <rmk@arm.linux.org.uk> told me that...\n> rmk@dyn-67:[linux-2.6-rmk]:<1049> cg-update origin\n> `../linux-2.6/.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901' -> `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901'\n> cp: cannot create link `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901': File exists\n> \n> By that time, the object files in the reference tree appear to have\n> a newer timestamp than the corresponding ones in my local tree, and\n> cp -lua fails.\n\nI'm now away ,unfortunately, and no immediate idea stems to my mind on\nhow to fix it. Ideas welcomed - I need to hardlink missing entries from\none tree to another; it would be enough to be able to just tell cp to\nignore already present files.\n\nCould you please try to give cp the -f flag?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2164","messageId":"20050429195055.GE1233@mythryan2.michonline.com","threadId":"393","inReplyTo":"20050429182708.GB14202@pasky.ji.cz","subject":"Re: More problems...","fromName":"Ryan Anderson","fromEmail":"ryan@michonline.com","sentAt":"2005-04-29T19:50:55Z","receivedAt":"2005-04-29T19:50:55Z","isPatch":false,"sender":{"key":"ryan@michonline.com","avatar":null},"body":"On Fri, Apr 29, 2005 at 08:27:08PM +0200, Petr Baudis wrote:\n> Dear diary, on Fri, Apr 29, 2005 at 06:01:27PM CEST, I got a letter\n> where Russell King <rmk@arm.linux.org.uk> told me that...\n> > rmk@dyn-67:[linux-2.6-rmk]:<1049> cg-update origin\n> > `../linux-2.6/.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901' -> `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901'\n> > cp: cannot create link `.git/objects/00/78aeb85737197a84af1eeb0353dbef74427901': File exists\n> > \n> > By that time, the object files in the reference tree appear to have\n> > a newer timestamp than the corresponding ones in my local tree, and\n> > cp -lua fails.\n> \n> I'm now away ,unfortunately, and no immediate idea stems to my mind on\n> how to fix it. Ideas welcomed - I need to hardlink missing entries from\n> one tree to another; it would be enough to be able to just tell cp to\n> ignore already present files.\n> \n> Could you please try to give cp the -f flag?\n\nWhy not just use \"rsync\" for both remote and local synchronization, and\nprovide a \"relink\" command to scan two .git/objects/ repositories and\nhardlink matching files together?\n\nWith the SHA1 hash, you can even have a --unsafe option that just\ncompares the has names and does a link based purely off of that and the\nstat(2) results of both files.  (I'd expect that a ... safer variant\nwould extract both files and compare them, but the --unsafe should be\nsufficient, in practice, I would think.)\n\n-- \n\nRyan Anderson\n  sometimes Pug Majere\n"},{"id":"2167","messageId":"20050429200338.GL7331@cip.informatik.uni-erlangen.de","threadId":"393","inReplyTo":"20050429195055.GE1233@mythryan2.michonline.com","subject":"Re: More problems...","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2005-04-29T20:03:38Z","receivedAt":"2005-04-29T20:03:38Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\n\n> Why not just use \"rsync\" for both remote and local synchronization, and\n> provide a \"relink\" command to scan two .git/objects/ repositories and\n> hardlink matching files together?\n\nThat came to my mind, too. And it is actually the only thing that makes\nsense. - In matters of KISS. :-)\n\n\tThomas\n"},{"id":"2176","messageId":"Pine.LNX.4.58.0504291311320.18901@ppc970.osdl.org","threadId":"393","inReplyTo":"20050429195055.GE1233@mythryan2.michonline.com","subject":"Re: More problems...","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-04-29T20:21:21Z","receivedAt":"2005-04-29T20:21:21Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 29 Apr 2005, Ryan Anderson wrote:\n> \n> Why not just use \"rsync\" for both remote and local synchronization, and\n> provide a \"relink\" command to scan two .git/objects/ repositories and\n> hardlink matching files together?\n\nAbsolutely. I use the same \"git-pull-script\" between two local directories \non disk. The only issue there is that you have to give the \".git\" \ndirectory, ie you should do\n\n\tgit-pull-script ~/by/other/repository/.git\n\ninstead of pointing to the other repo's root.\n\nOf course, I don't bother with the linking. But that's the trivial part.\n\n> With the SHA1 hash, you can even have a --unsafe option that just\n> compares the has names and does a link based purely off of that and the\n> stat(2) results of both files.  (I'd expect that a ... safer variant\n> would extract both files and compare them, but the --unsafe should be\n> sufficient, in practice, I would think.)\n\nI don't think there is any point to unsafe. The assumption is that if you \ndo things this way, the \"unlinked\" files will the the uncommon case, so \nwhat you do is\n\n - remember the list of files you copied when you did the pull (you had to \n   have this list at some point anyway). Sort by name,\n - create a list of names of both repositories, sorted by name\n - do the union of those three lists (cheap, thanks to the sorting)\n - stat each name to see if it's already linked (which it will be, most of \n   the time), continue to the next one..\n - if they aren't linked, just do a \"cmp\" on them, and warn if they aren't \n   the same, continue to the next one.\n - else link them.\n\nAnd if you want to, you can skip the first stage, and just relink two\ntrees without looking at a list of \"known new\" files - it's going to be\nexpensive to link two big repositories the _first_ time, but hey even the\n\"expensive\" part is likely to be pretty cheap in the end. If it takes an\nhour or two to relink some years of history, big deal. Do it overnight,\nyou only need it once.\n\n\t\tLinus\n"},{"id":"2188","messageId":"7vhdhp47hq.fsf@assigned-by-dhcp.cox.net","threadId":"393","inReplyTo":"Pine.LNX.4.58.0504291311320.18901@ppc970.osdl.org","subject":"Re: More problems...","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-29T21:07:29Z","receivedAt":"2005-04-29T21:07:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> Absolutely. I use the same \"git-pull-script\" between two local directories \nLT> on disk...\nLT> Of course, I don't bother with the linking. But that's the trivial part.\n\nWould it be useful if somebody wrote local-pull.c similar to\nhttp-pull.c, which clones one local SHA_FILE_DIRECTORY to\nanother, with an option to (1) try hardlink and if it fails\nfail; (2) try hardlink and if it fails try symlink and if it\nfails fail; (3) try hardlink and if it fails try copy and if it\nfails fail?\n\nThen from a source repository that contains good stuff plus\nthrowaway experimental commits you can prepare pruned for-public\ntree.  Of course you can do it today by copying and then running\ngit-prune in the destination, though.\n\n\n"},{"id":"2190","messageId":"20050429221903.F30010@flint.arm.linux.org.uk","threadId":"393","inReplyTo":"7vhdhp47hq.fsf@assigned-by-dhcp.cox.net","subject":"Re: More problems...","fromName":"Russell King","fromEmail":"rmk@arm.linux.org.uk","sentAt":"2005-04-29T21:19:03Z","receivedAt":"2005-04-29T21:19:03Z","isPatch":false,"sender":{"key":"rmk@arm.linux.org.uk","avatar":null},"body":"On Fri, Apr 29, 2005 at 02:07:29PM -0700, Junio C Hamano wrote:\n> >>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n> \n> LT> Absolutely. I use the same \"git-pull-script\" between two local directories \n> LT> on disk...\n> LT> Of course, I don't bother with the linking. But that's the trivial part.\n> \n> Would it be useful if somebody wrote local-pull.c similar to\n> http-pull.c, which clones one local SHA_FILE_DIRECTORY to\n> another, with an option to (1) try hardlink and if it fails\n> fail; (2) try hardlink and if it fails try symlink and if it\n> fails fail; (3) try hardlink and if it fails try copy and if it\n> fails fail?\n\nWhat would be nice is if it finds an existing file for the one it's\ntrying to hard link, it compares the contents (maybe - is this actually\nnecessary?) and if identical, it removes the original file replacing\nit with a hard link.\n\nThis means that you'll always be trying to maintain the hard linked\nstructure between various working trees in the background.\n\nBut maybe this should have an option to enable this behaviour.\n\n-- \nRussell King\n\n"},{"id":"2196","messageId":"Pine.LNX.4.21.0504291717360.30848-100000@iabervon.org","threadId":"393","inReplyTo":"7vhdhp47hq.fsf@assigned-by-dhcp.cox.net","subject":"Re: More problems...","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-04-29T21:27:57Z","receivedAt":"2005-04-29T21:27:57Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Fri, 29 Apr 2005, Junio C Hamano wrote:\n\n> >>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n> \n> LT> Absolutely. I use the same \"git-pull-script\" between two local directories \n> LT> on disk...\n> LT> Of course, I don't bother with the linking. But that's the trivial part.\n> \n> Would it be useful if somebody wrote local-pull.c similar to\n> http-pull.c, which clones one local SHA_FILE_DIRECTORY to\n> another, with an option to (1) try hardlink and if it fails\n> fail; (2) try hardlink and if it fails try symlink and if it\n> fails fail; (3) try hardlink and if it fails try copy and if it\n> fails fail?\n\nIf someone does this, they should make a pull.c out of http-pull and\nrpull; the logic for determining what you need to copy, given what you\nhave and what the user wants to have, should be shared.\n\n(Note that some usage patterns only require the latest commit, or at least\ncan deal with fetching other stuff only when needed.)\n\n\t-Daniel\n*This .sig left intentionally blank*\n\n"},{"id":"2201","messageId":"Pine.LNX.4.60.0504292254430.25700@hermes-1.csi.cam.ac.uk","threadId":"393","inReplyTo":"20050429221903.F30010@flint.arm.linux.org.uk","subject":"Re: More problems...","fromName":"Anton Altaparmakov","fromEmail":"aia21@cam.ac.uk","sentAt":"2005-04-29T21:57:53Z","receivedAt":"2005-04-29T21:57:53Z","isPatch":false,"sender":{"key":"aia21@cam.ac.uk","avatar":null},"body":"On Fri, 29 Apr 2005, Russell King wrote:\n> On Fri, Apr 29, 2005 at 02:07:29PM -0700, Junio C Hamano wrote:\n> > >>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n> > LT> Absolutely. I use the same \"git-pull-script\" between two local directories \n> > LT> on disk...\n> > LT> Of course, I don't bother with the linking. But that's the trivial part.\n> > \n> > Would it be useful if somebody wrote local-pull.c similar to\n> > http-pull.c, which clones one local SHA_FILE_DIRECTORY to\n> > another, with an option to (1) try hardlink and if it fails\n> > fail; (2) try hardlink and if it fails try symlink and if it\n> > fails fail; (3) try hardlink and if it fails try copy and if it\n> > fails fail?\n> \n> What would be nice is if it finds an existing file for the one it's\n> trying to hard link, it compares the contents (maybe - is this actually\n> necessary?) and if identical, it removes the original file replacing\n> it with a hard link.\n\nUnless I have completely misunderstood things, you never need to compare \nthe file contents.  Just compare the file names.  If they match, i.e. the \nSHA1 is the same, the contents must match by definition.  So you only need \na stat(), rather than read&decompress&compare.\n\n> This means that you'll always be trying to maintain the hard linked\n> structure between various working trees in the background.\n> \n> But maybe this should have an option to enable this behaviour.\n\nThere should definitely be an option to either enable or disable this as \nthere are legitimate cases for not wanting hard links or indeed using \nfile systems which do not support them.\n\nBest regards,\n\n\tAnton\n-- \nAnton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)\nUnix Support, Computing Service, University of Cambridge, CB2 3QH, UK\nLinux NTFS maintainer / IRC: #ntfs on irc.freenode.net\nWWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/\n"},{"id":"2204","messageId":"7vy8b12qg1.fsf@assigned-by-dhcp.cox.net","threadId":"393","inReplyTo":"Pine.LNX.4.21.0504291717360.30848-100000@iabervon.org","subject":"Re: More problems...","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-29T22:01:02Z","receivedAt":"2005-04-29T22:01:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"DB\" == Daniel Barkalow <barkalow@iabervon.org> writes:\n\nDB> If someone does this, they should make a pull.c out of http-pull and\nDB> rpull; the logic for determining what you need to copy, given what you\nDB> have and what the user wants to have, should be shared.\n\nI agree with your analysis.  I was hoping that that someone\nwould be you, knowing where http-pull originated ;-).\n\n"},{"id":"2241","messageId":"Pine.LNX.4.21.0504300133430.30848-100000@iabervon.org","threadId":"393","inReplyTo":"7vy8b12qg1.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Split out \"pull\" from particular methods","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-04-30T05:36:30Z","receivedAt":"2005-04-30T05:36:30Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"The method for deciding what to pull is useful separately from any of the\nways of actually fetching the objects.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n\nSplit out \"pull\" functionality from http-pull and rpull\nIndex: Makefile\n===================================================================\n--- 8602fe7cb4bf668fd021ab3bfb2082ac7d535e57/Makefile  (mode:100644 sha1:ef9a9fae88a1ac438c22beb50790f0f0e37ffc3c)\n+++ 41f4697d0ada8e79a2f262aa9b6357a45194f31d/Makefile  (mode:100644 sha1:87fe8fef5ebd315f370af882bd3172632b850c02)\n@@ -82,9 +82,9 @@\n git-export: export.c\n git-diff-cache: diff-cache.c\n git-convert-cache: convert-cache.c\n-git-http-pull: http-pull.c\n+git-http-pull: http-pull.c pull.c\n git-rpush: rsh.c\n-git-rpull: rsh.c\n+git-rpull: rsh.c pull.c\n git-rev-list: rev-list.c\n git-mktag: mktag.c\n git-diff-tree-helper: diff-tree-helper.c\nIndex: http-pull.c\n===================================================================\n--- 8602fe7cb4bf668fd021ab3bfb2082ac7d535e57/http-pull.c  (mode:100644 sha1:192dcc370dee47c52c72915394bb6f2a79f64e12)\n+++ 41f4697d0ada8e79a2f262aa9b6357a45194f31d/http-pull.c  (mode:100644 sha1:d877c4abe3ff7766d858bfeac5c9a0eaf1385b65)\n@@ -7,6 +7,8 @@\n #include <errno.h>\n #include <stdio.h>\n \n+#include \"pull.h\"\n+\n #include <curl/curl.h>\n #include <curl/easy.h>\n \n@@ -14,10 +16,6 @@\n \n static char *base;\n \n-static int tree = 0;\n-static int commits = 0;\n-static int all = 0;\n-\n static SHA_CTX c;\n static z_stream stream;\n \n@@ -47,7 +45,7 @@\n \treturn size;\n }\n \n-static int fetch(unsigned char *sha1)\n+int fetch(unsigned char *sha1)\n {\n \tchar *hex = sha1_to_hex(sha1);\n \tchar *filename = sha1_file_name(sha1);\n@@ -105,77 +103,21 @@\n \treturn 0;\n }\n \n-static int process_tree(unsigned char *sha1)\n-{\n-\tstruct tree *tree = lookup_tree(sha1);\n-\tstruct tree_entry_list *entries;\n-\n-\tif (parse_tree(tree))\n-\t\treturn -1;\n-\n-\tfor (entries = tree->entries; entries; entries = entries->next) {\n-\t\tif (fetch(entries->item.tree->object.sha1))\n-\t\t\treturn -1;\n-\t\tif (entries->directory) {\n-\t\t\tif (process_tree(entries->item.tree->object.sha1))\n-\t\t\t\treturn -1;\n-\t\t}\n-\t}\n-\treturn 0;\n-}\n-\n-static int process_commit(unsigned char *sha1)\n-{\n-\tstruct commit *obj = lookup_commit(sha1);\n-\n-\tif (fetch(sha1))\n-\t\treturn -1;\n-\n-\tif (parse_commit(obj))\n-\t\treturn -1;\n-\n-\tif (tree) {\n-\t\tif (fetch(obj->tree->object.sha1))\n-\t\t\treturn -1;\n-\t\tif (process_tree(obj->tree->object.sha1))\n-\t\t\treturn -1;\n-\t\tif (!all)\n-\t\t\ttree = 0;\n-\t}\n-\tif (commits) {\n-\t\tstruct commit_list *parents = obj->parents;\n-\t\tfor (; parents; parents = parents->next) {\n-\t\t\tif (has_sha1_file(parents->item->object.sha1))\n-\t\t\t\tcontinue;\n-\t\t\tif (fetch(parents->item->object.sha1)) {\n-\t\t\t\t/* The server might not have it, and\n-\t\t\t\t * we don't mind. \n-\t\t\t\t */\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t\tif (process_commit(parents->item->object.sha1))\n-\t\t\t\treturn -1;\n-\t\t}\n-\t}\n-\treturn 0;\n-}\n-\n int main(int argc, char **argv)\n {\n \tchar *commit_id;\n \tchar *url;\n \tint arg = 1;\n-\tunsigned char sha1[20];\n \n \twhile (arg < argc && argv[arg][0] == '-') {\n \t\tif (argv[arg][1] == 't') {\n-\t\t\ttree = 1;\n+\t\t\tget_tree = 1;\n \t\t} else if (argv[arg][1] == 'c') {\n-\t\t\tcommits = 1;\n+\t\t\tget_history = 1;\n \t\t} else if (argv[arg][1] == 'a') {\n-\t\t\tall = 1;\n-\t\t\ttree = 1;\n-\t\t\tcommits = 1;\n+\t\t\tget_all = 1;\n+\t\t\tget_tree = 1;\n+\t\t\tget_history = 1;\n \t\t}\n \t\targ++;\n \t}\n@@ -186,17 +128,13 @@\n \tcommit_id = argv[arg];\n \turl = argv[arg + 1];\n \n-\tget_sha1_hex(commit_id, sha1);\n-\n \tcurl_global_init(CURL_GLOBAL_ALL);\n \n \tcurl = curl_easy_init();\n \n \tbase = url;\n \n-\tif (fetch(sha1))\n-\t\treturn 1;\n-\tif (process_commit(sha1))\n+\tif (pull(commit_id))\n \t\treturn 1;\n \n \tcurl_global_cleanup();\nIndex: pull.c\n===================================================================\n--- /dev/null  (tree:8602fe7cb4bf668fd021ab3bfb2082ac7d535e57)\n+++ 41f4697d0ada8e79a2f262aa9b6357a45194f31d/pull.c  (mode:100644 sha1:86a7b6901fe69a82c12c3470b456982ef52cebd0)\n@@ -0,0 +1,77 @@\n+#include \"pull.h\"\n+\n+#include \"cache.h\"\n+#include \"commit.h\"\n+#include \"tree.h\"\n+\n+int get_tree = 0;\n+int get_history = 0;\n+int get_all = 0;\n+\n+static int process_tree(unsigned char *sha1)\n+{\n+\tstruct tree *tree = lookup_tree(sha1);\n+\tstruct tree_entry_list *entries;\n+\n+\tif (parse_tree(tree))\n+\t\treturn -1;\n+\n+\tfor (entries = tree->entries; entries; entries = entries->next) {\n+\t\tif (fetch(entries->item.tree->object.sha1))\n+\t\t\treturn -1;\n+\t\tif (entries->directory) {\n+\t\t\tif (process_tree(entries->item.tree->object.sha1))\n+\t\t\t\treturn -1;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+static int process_commit(unsigned char *sha1)\n+{\n+\tstruct commit *obj = lookup_commit(sha1);\n+\n+\tif (fetch(sha1))\n+\t\treturn -1;\n+\n+\tif (parse_commit(obj))\n+\t\treturn -1;\n+\n+\tif (get_tree) {\n+\t\tif (fetch(obj->tree->object.sha1))\n+\t\t\treturn -1;\n+\t\tif (process_tree(obj->tree->object.sha1))\n+\t\t\treturn -1;\n+\t\tif (!get_all)\n+\t\t\tget_tree = 0;\n+\t}\n+\tif (get_history) {\n+\t\tstruct commit_list *parents = obj->parents;\n+\t\tfor (; parents; parents = parents->next) {\n+\t\t\tif (has_sha1_file(parents->item->object.sha1))\n+\t\t\t\tcontinue;\n+\t\t\tif (fetch(parents->item->object.sha1)) {\n+\t\t\t\t/* The server might not have it, and\n+\t\t\t\t * we don't mind. \n+\t\t\t\t */\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (process_commit(parents->item->object.sha1))\n+\t\t\t\treturn -1;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+int pull(char *target)\n+{\n+\tint retval;\n+\tunsigned char sha1[20];\n+\tretval = get_sha1_hex(target, sha1);\n+\tif (retval)\n+\t\treturn retval;\n+\tretval = fetch(sha1);\n+\tif (retval)\n+\t\treturn retval;\n+\treturn process_commit(sha1);\n+}\nIndex: pull.h\n===================================================================\n--- /dev/null  (tree:8602fe7cb4bf668fd021ab3bfb2082ac7d535e57)\n+++ 41f4697d0ada8e79a2f262aa9b6357a45194f31d/pull.h  (mode:100644 sha1:314bc7e95ab1a73634f6a96a8a3782fda91ea261)\n@@ -0,0 +1,18 @@\n+#ifndef PULL_H\n+#define PULL_H\n+\n+/** To be provided by the particular implementation. **/\n+extern int fetch(unsigned char *sha1);\n+\n+/** Set to fetch the target tree. */\n+extern int get_tree;\n+\n+/** Set to fetch the commit history. */\n+extern int get_history;\n+\n+/** Set to fetch the trees in the commit history. **/\n+extern int get_all;\n+\n+extern int pull(char *target);\n+\n+#endif /* PULL_H */\nIndex: rpull.c\n===================================================================\n--- 8602fe7cb4bf668fd021ab3bfb2082ac7d535e57/rpull.c  (mode:100644 sha1:c27af2c2464de28732b8ad1fff3ed8a0804250d6)\n+++ 41f4697d0ada8e79a2f262aa9b6357a45194f31d/rpull.c  (mode:100644 sha1:6624440d5ad24854e1bd1a8dff628427581198e0)\n@@ -7,15 +7,12 @@\n #include <errno.h>\n #include <stdio.h>\n #include \"rsh.h\"\n-\n-static int tree = 0;\n-static int commits = 0;\n-static int all = 0;\n+#include \"pull.h\"\n \n static int fd_in;\n static int fd_out;\n \n-static int fetch(unsigned char *sha1)\n+int fetch(unsigned char *sha1)\n {\n \tif (has_sha1_file(sha1))\n \t\treturn 0;\n@@ -23,87 +20,21 @@\n \treturn write_sha1_from_fd(sha1, fd_in);\n }\n \n-static int process_tree(unsigned char *sha1)\n-{\n-\tstruct tree *tree = lookup_tree(sha1);\n-\tstruct tree_entry_list *entries;\n-\n-\tif (parse_tree(tree))\n-\t\treturn -1;\n-\n-\tfor (entries = tree->entries; entries; entries = entries->next) {\n-\t\t/*\n-\t\t  fprintf(stderr, \"Tree %s \", sha1_to_hex(sha1));\n-\t\t  fprintf(stderr, \"needs %s\\n\", \n-\t\t  sha1_to_hex(entries->item.tree->object.sha1));\n-\t\t*/\n-\t\tif (fetch(entries->item.tree->object.sha1)) {\n-\t\t\treturn error(\"Missing item %s\",\n-\t\t\t\t     sha1_to_hex(entries->item.tree->object.sha1));\n-\t\t}\n-\t\tif (entries->directory) {\n-\t\t\tif (process_tree(entries->item.tree->object.sha1))\n-\t\t\t\treturn -1;\n-\t\t}\n-\t}\n-\treturn 0;\n-}\n-\n-static int process_commit(unsigned char *sha1)\n-{\n-\tstruct commit *obj = lookup_commit(sha1);\n-\n-\tif (fetch(sha1)) {\n-\t\treturn error(\"Fetching %s\", sha1_to_hex(sha1));\n-\t}\n-\n-\tif (parse_commit(obj))\n-\t\treturn -1;\n-\n-\tif (tree) {\n-\t\tif (fetch(obj->tree->object.sha1))\n-\t\t\treturn -1;\n-\t\tif (process_tree(obj->tree->object.sha1))\n-\t\t\treturn -1;\n-\t\tif (!all)\n-\t\t\ttree = 0;\n-\t}\n-\tif (commits) {\n-\t\tstruct commit_list *parents = obj->parents;\n-\t\tfor (; parents; parents = parents->next) {\n-\t\t\tif (has_sha1_file(parents->item->object.sha1))\n-\t\t\t\tcontinue;\n-\t\t\tif (fetch(parents->item->object.sha1)) {\n-\t\t\t\t/* The server might not have it, and\n-\t\t\t\t * we don't mind. \n-\t\t\t\t */\n-\t\t\t\terror(\"Missing tree %s; continuing\", \n-\t\t\t\t      sha1_to_hex(parents->item->object.sha1));\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t\tif (process_commit(parents->item->object.sha1))\n-\t\t\t\treturn -1;\n-\t\t}\n-\t}\n-\treturn 0;\n-}\n-\n int main(int argc, char **argv)\n {\n \tchar *commit_id;\n \tchar *url;\n \tint arg = 1;\n-\tunsigned char sha1[20];\n \n \twhile (arg < argc && argv[arg][0] == '-') {\n \t\tif (argv[arg][1] == 't') {\n-\t\t\ttree = 1;\n+\t\t\tget_tree = 1;\n \t\t} else if (argv[arg][1] == 'c') {\n-\t\t\tcommits = 1;\n+\t\t\tget_history = 1;\n \t\t} else if (argv[arg][1] == 'a') {\n-\t\t\tall = 1;\n-\t\t\ttree = 1;\n-\t\t\tcommits = 1;\n+\t\t\tget_all = 1;\n+\t\t\tget_tree = 1;\n+\t\t\tget_history = 1;\n \t\t}\n \t\targ++;\n \t}\n@@ -117,11 +48,7 @@\n \tif (setup_connection(&fd_in, &fd_out, \"rpush\", url, arg, argv + 1))\n \t\treturn 1;\n \n-\tget_sha1_hex(commit_id, sha1);\n-\n-\tif (fetch(sha1))\n-\t\treturn 1;\n-\tif (process_commit(sha1))\n+\tif (pull(commit_id))\n \t\treturn 1;\n \n \treturn 0;\n\n"},{"id":"2394","messageId":"20050502193327.GB20818@pasky.ji.cz","threadId":"393","inReplyTo":"Pine.LNX.4.60.0504292254430.25700@hermes-1.csi.cam.ac.uk","subject":"Re: More problems...","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-02T19:33:27Z","receivedAt":"2005-05-02T19:33:27Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Apr 29, 2005 at 11:57:53PM CEST, I got a letter\nwhere Anton Altaparmakov <aia21@cam.ac.uk> told me that...\n> There should definitely be an option to either enable or disable this as \n> there are legitimate cases for not wanting hard links or indeed using \n> file systems which do not support them.\n\nAre there legitimate cases for not wanting hard links when you are able\nto create them? (Same filesystem, filesystem supports them...)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2395","messageId":"1115063079.8041.5.camel@kleikamp","threadId":"393","inReplyTo":"20050502193327.GB20818@pasky.ji.cz","subject":"Re: More problems...","fromName":"Dave Kleikamp","fromEmail":"shaggy@austin.ibm.com","sentAt":"2005-05-02T19:44:38Z","receivedAt":"2005-05-02T19:44:38Z","isPatch":false,"sender":{"key":"shaggy@austin.ibm.com","avatar":null},"body":"On Mon, 2005-05-02 at 21:33 +0200, Petr Baudis wrote:\n> Dear diary, on Fri, Apr 29, 2005 at 11:57:53PM CEST, I got a letter\n> where Anton Altaparmakov <aia21@cam.ac.uk> told me that...\n> > There should definitely be an option to either enable or disable this as \n> > there are legitimate cases for not wanting hard links or indeed using \n> > file systems which do not support them.\n> \n> Are there legitimate cases for not wanting hard links when you are able\n> to create them? (Same filesystem, filesystem supports them...)\n\nCloning a different user's repo?\n-- \nDavid Kleikamp\nIBM Linux Technology Center\n\n"},{"id":"2396","messageId":"20050502195153.GC25004@cip.informatik.uni-erlangen.de","threadId":"393","inReplyTo":"1115063079.8041.5.camel@kleikamp","subject":"Re: More problems...","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2005-05-02T19:51:53Z","receivedAt":"2005-05-02T19:51:53Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\n\n> Cloning a different user's repo?\n\nit isn't my quota. :-) So that's a feature. :-)\n\n\tThomas\n"},{"id":"2401","messageId":"20050502211349.GD20818@pasky.ji.cz","threadId":"393","inReplyTo":"20050429195055.GE1233@mythryan2.michonline.com","subject":"Re: More problems...","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-02T21:13:49Z","receivedAt":"2005-05-02T21:13:49Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Apr 29, 2005 at 09:50:55PM CEST, I got a letter\nwhere Ryan Anderson <ryan@michonline.com> told me that...\n> Why not just use \"rsync\" for both remote and local synchronization, and\n> provide a \"relink\" command to scan two .git/objects/ repositories and\n> hardlink matching files together?\n\nNo. This completely misses the point, which is to avoid useless I/O when\ndoing this local stuff; also, it saves disk space to a degree, but it is\nwildly fluctuating.\n\nI like Junio's local-pull solution much more (from the conceptual\nstandpoint; I didn't look at the code yet).\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2407","messageId":"Pine.LNX.4.60.0505022258150.27741@hermes-1.csi.cam.ac.uk","threadId":"393","inReplyTo":"20050502193327.GB20818@pasky.ji.cz","subject":"Re: More problems...","fromName":"Anton Altaparmakov","fromEmail":"aia21@cam.ac.uk","sentAt":"2005-05-02T22:01:01Z","receivedAt":"2005-05-02T22:01:01Z","isPatch":false,"sender":{"key":"aia21@cam.ac.uk","avatar":null},"body":"On Mon, 2 May 2005, Petr Baudis wrote:\n> Dear diary, on Fri, Apr 29, 2005 at 11:57:53PM CEST, I got a letter\n> where Anton Altaparmakov <aia21@cam.ac.uk> told me that...\n> > There should definitely be an option to either enable or disable this as \n> > there are legitimate cases for not wanting hard links or indeed using \n> > file systems which do not support them.\n> \n> Are there legitimate cases for not wanting hard links when you are able\n> to create them? (Same filesystem, filesystem supports them...)\n\nI would say yes.  For example, I want to update my git tools to the latest \nand greatest development version.  Do I really want to let it loose on all \nthe repositories?  Probably not.  So I would want to make a clone of the \nrepository that is not connected in any way with the old one and then \ntry the new tools.  If there were hard links involved working on the \ncloned repository could potentially damage the original one.\n\nYes, yes, I know all tools are perfect and never have bugs but I am \nparanoid.  (-;\n\nBest regards,\n\n\tAnton\n-- \nAnton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)\nUnix Support, Computing Service, University of Cambridge, CB2 3QH, UK\nLinux NTFS maintainer / IRC: #ntfs on irc.freenode.net\nWWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/\n"},{"id":"2405","messageId":"Pine.LNX.4.58.0505021509530.3594@ppc970.osdl.org","threadId":"393","inReplyTo":"Pine.LNX.4.60.0505022258150.27741@hermes-1.csi.cam.ac.uk","subject":"Re: More problems...","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-02T22:19:16Z","receivedAt":"2005-05-02T22:19:16Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 2 May 2005, Anton Altaparmakov wrote:\n> \n> Yes, yes, I know all tools are perfect and never have bugs but I am\n> paranoid.  (-;\n\nI do agree.\n\nI think hardlinks are wonderful for\n\n - \"git farms\" (ie something like what kernel.org does, but in a more \n   controlled manner - right now kernel.org is really just a standard\n   location for different people putting their own files in).\n\n   In this environment, doing hard-linking should also imply \n\n\t- mounting the filesystem \"noatime\"\n\t- using a different UID for the hardlinked objects\n\n   ie the \"farm administrator\" does the hardlinking automatically, and \n   chown()'s them to himself, so that different git trees cannot screw \n   each other up. The \"noatime\" thing is there because having different \n   users means that git's internal \"O_NOATIME\" optimization no longer \n   works, and you really want to avoi dgetting lots of write-backs just \n   for \"atime\".\n\n - people who have lots of trees. I think Jeff Garzik has something like\n   20+ BK trees. At that point, hardlinking just makes sense, and your \n   work patterns are likely to be aware of the different trees anyway.\n\nBut for \"normal\" situations, where you have a tree or two, the hardlinking \nwin might not be big enough to warrant the maintenance headache. With \nhardlinking, you _do_ need to \"trust\" the other trees to some degree.\n\n\t\tLinus\n"},{"id":"2431","messageId":"20050503014816.GQ20818@pasky.ji.cz","threadId":"393","inReplyTo":"Pine.LNX.4.58.0505021509530.3594@ppc970.osdl.org","subject":"Re: More problems...","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-03T01:48:16Z","receivedAt":"2005-05-03T01:48:16Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, May 03, 2005 at 12:19:16AM CEST, I got a letter\nwhere Linus Torvalds <torvalds@osdl.org> told me that...\n> But for \"normal\" situations, where you have a tree or two, the hardlinking \n> win might not be big enough to warrant the maintenance headache. With \n> hardlinking, you _do_ need to \"trust\" the other trees to some degree.\n\nAs long as the trees aren't yours and you aren't doing something really\nhorrible with them...\n\n$ time git-local-pull -a -l $(cat ~/git-devel/.git/HEAD) ~/git-devel/.git/\nreal    0m0.332s\n\n$ time git-local-pull -a $(cat ~/git-devel/.git/HEAD) ~/git-devel/.git/\nreal    0m4.306s\n\nAnd this is only 13M Cogito objects database. I think one of the\nimportant things is to encourage branching, therefore it must be fast\nenough; that's why I really wanted to do hardlinks. The disk space is\nimportant, but the speed hit probably equally (if not more) so.\n\nBTW, the object database files should have 0444 or such; they really\n_are_ read-only and making them so mode-wise could help against some\nmistakes too.\n\nIt's clear that Cogito should have a way to choose whether to hardlink\nor copy; the question is which one should be the default one and how\nshould it be specified.  I thought about using file:// vs. just local\npath to differentiate between copy and hardlinking, but that'd be\ntotally non-obvious, therefore bad UI-wise.\n\nBTW, I've just committed support for pulling from remote repositories\nover the HTTP and SSH protocols (http://your.git/repo,\ngit+ssh://root@git.nasa.gov/srv/git/mars) (note that I was unable to\ntest the SSH stuff properly now; success reports or patches welcome).\nAlso, the local hardlinking access is now done over git-local-pull,\ntherefore the cp errors should go away now.\n\nI'm not yet decided whether locations like\n\n\tkernel.org:/pub/scm/cogito/cogito.git\n\nshould invoke rsync, rpull, throw an error or print a fortune cookie.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2436","messageId":"Pine.LNX.4.21.0505022240040.30848-100000@iabervon.org","threadId":"393","inReplyTo":"20050503014816.GQ20818@pasky.ji.cz","subject":"Re: More problems...","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-05-03T02:56:37Z","receivedAt":"2005-05-03T02:56:37Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 3 May 2005, Petr Baudis wrote:\n\n> BTW, I've just committed support for pulling from remote repositories\n> over the HTTP and SSH protocols (http://your.git/repo,\n> git+ssh://root@git.nasa.gov/srv/git/mars) (note that I was unable to\n> test the SSH stuff properly now; success reports or patches welcome).\n> Also, the local hardlinking access is now done over git-local-pull,\n> therefore the cp errors should go away now.\n\nBefore you get too far with the SSH version, I have some protocol changes\nwhich (1) allow transmission of things other than objects; (2) allow the\npushing side to report that it doesn't have something without killing the\nconnection; (3) send refs. (1) and (2) are needed to make the protocol\nextensible; (3) takes advantage of (1) to make it possible to maintain a\nremote repository without doing anything other than rpush to it.\n\nThis goes with my patches from the weekend to enable git-*-pull to\ntransfer refs/ files in the same process.\n\n> I'm not yet decided whether locations like\n> \n> \tkernel.org:/pub/scm/cogito/cogito.git\n> \n> should invoke rsync, rpull, throw an error or print a fortune cookie.\n\nProbably not rpull, which requires a login, at least not unless the others\nfail. I think that http-pull is going to be nicer in the long run than\nrsync, since the remote repository could have a bunch of mingled heads\nand http-pull will get exclusively the interesting stuff. If you're trying\nto push, then rpush, since that's the only push.\n\nPersonally, I've been using http://... for http-pull, rsync://... for\nrsync, and //... for rpull/rpush (which is somewhat justified wrt the URI\nstandard for using the program's default method).\n\n\t-Daniel\n*This .sig left intentionally blank*\n\n"},{"id":"2472","messageId":"Pine.LNX.4.58.0505030757440.29716@sam.ics.uci.edu","threadId":"393","inReplyTo":"20050503014816.GQ20818@pasky.ji.cz","subject":"Re: More problems...","fromName":"Andreas Gal","fromEmail":"gal@uci.edu","sentAt":"2005-05-03T15:00:42Z","receivedAt":"2005-05-03T15:00:42Z","isPatch":false,"sender":{"key":"gal@uci.edu","avatar":null},"body":"\nI am just soft-linking objects/ in the branched tree. I can live with \ndangling objects, branching is extremly fast, and diskspace is cheap \nanyway. The only downside is that it doesn't work too well with rsync as \nnetwork protocol, but I use only http-pull and rpush anyway.\n\nAndreas\n\nOn Tue, 3 May 2005, Petr Baudis wrote:\n\n> Dear diary, on Tue, May 03, 2005 at 12:19:16AM CEST, I got a letter\n> where Linus Torvalds <torvalds@osdl.org> told me that...\n> > But for \"normal\" situations, where you have a tree or two, the hardlinking \n> > win might not be big enough to warrant the maintenance headache. With \n> > hardlinking, you _do_ need to \"trust\" the other trees to some degree.\n> \n> As long as the trees aren't yours and you aren't doing something really\n> horrible with them...\n> \n> $ time git-local-pull -a -l $(cat ~/git-devel/.git/HEAD) ~/git-devel/.git/\n> real    0m0.332s\n> \n> $ time git-local-pull -a $(cat ~/git-devel/.git/HEAD) ~/git-devel/.git/\n> real    0m4.306s\n> \n> And this is only 13M Cogito objects database. I think one of the\n> important things is to encourage branching, therefore it must be fast\n> enough; that's why I really wanted to do hardlinks. The disk space is\n> important, but the speed hit probably equally (if not more) so.\n> \n> BTW, the object database files should have 0444 or such; they really\n> _are_ read-only and making them so mode-wise could help against some\n> mistakes too.\n> \n> It's clear that Cogito should have a way to choose whether to hardlink\n> or copy; the question is which one should be the default one and how\n> should it be specified.  I thought about using file:// vs. just local\n> path to differentiate between copy and hardlinking, but that'd be\n> totally non-obvious, therefore bad UI-wise.\n> \n> BTW, I've just committed support for pulling from remote repositories\n> over the HTTP and SSH protocols (http://your.git/repo,\n> git+ssh://root@git.nasa.gov/srv/git/mars) (note that I was unable to\n> test the SSH stuff properly now; success reports or patches welcome).\n> Also, the local hardlinking access is now done over git-local-pull,\n> therefore the cp errors should go away now.\n> \n> I'm not yet decided whether locations like\n> \n> \tkernel.org:/pub/scm/cogito/cogito.git\n> \n> should invoke rsync, rpull, throw an error or print a fortune cookie.\n> \n> -- \n> \t\t\t\tPetr \"Pasky\" Baudis\n> Stuff: http://pasky.or.cz/\n> C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"},{"id":"2501","messageId":"7v7jigw238.fsf@assigned-by-dhcp.cox.net","threadId":"393","inReplyTo":"Pine.LNX.4.58.0505030757440.29716@sam.ics.uci.edu","subject":"Re: More problems...","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-03T19:18:03Z","receivedAt":"2005-05-03T19:18:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"AG\" == Andreas Gal <gal@uci.edu> writes:\n\nAG> I am just soft-linking objects/ in the branched tree. I can live with \nAG> dangling objects, branching is extremly fast, and diskspace is cheap \nAG> anyway. The only downside is that it doesn't work too well with rsync as \nAG> network protocol,...\n\nI usually do not symlinks myself, but doesn't \"rsync -L\" work\nfor you?\n\n"},{"id":"2561","messageId":"20050504055401.GC1740@mythryan2.michonline.com","threadId":"393","inReplyTo":"Pine.LNX.4.58.0504291311320.18901@ppc970.osdl.org","subject":"[PATCH] Add git-relink-script, a tool to hardlink two existing repositories.","fromName":"Ryan Anderson","fromEmail":"ryan@michonline.com","sentAt":"2005-05-04T05:54:01Z","receivedAt":"2005-05-04T05:54:01Z","isPatch":true,"sender":{"key":"ryan@michonline.com","avatar":null},"body":"\nAdd git-relink-script, which will find common objects in two git\nrepositories and replace one copy with a hardlink.\n\nSigned-Off-By: Ryan Anderson <ryan@michonline.com>\n\n---\ncommit a3bcc763d71bdb91a3b48e9105fbaa5e79abb807\ntree 2553e2d8befbe0cda3e413616fd4cc7bf04157ad\nparent a31c6d022e2435a514fcc8ca57f9995c4376a986\nauthor Ryan Anderson <ryan@mythryan2.(none)> 1115185675 -0400\ncommitter Ryan Anderson <ryan@michonline.com> 1115185675 -0400\n\nIndex: Makefile\n===================================================================\n--- 51a882a2dc62e0d3cdc79e0badc61559fb723481/Makefile  (mode:100644 sha1:99b4753d34879842b972da9b68694c9d0485f216)\n+++ 2553e2d8befbe0cda3e413616fd4cc7bf04157ad/Makefile  (mode:100644 sha1:a99665e252a2342caa84238e886a80a5f27ac3c8)\n@@ -13,7 +13,7 @@\n AR=ar\n \n SCRIPTS=git-apply-patch-script git-merge-one-file-script git-prune-script \\\n-\tgit-pull-script git-tag-script\n+\tgit-pull-script git-tag-script git-relink-script\n \n PROG=   git-update-cache git-diff-files git-init-db git-write-tree \\\n \tgit-read-tree git-commit-tree git-cat-file git-fsck-cache \\\nIndex: git-relink-script\n===================================================================\n--- /dev/null  (tree:51a882a2dc62e0d3cdc79e0badc61559fb723481)\n+++ 2553e2d8befbe0cda3e413616fd4cc7bf04157ad/git-relink-script  (mode:100644 sha1:78c954edcc370d8be951c856bfbfd38975d08348)\n@@ -0,0 +1,115 @@\n+#!/usr/bin/env perl\n+# Copyright 2005, Ryan Anderson <ryan@michonline.com>\n+# Distribution permitted under the GPL v2, as distributed\n+# by the Free Software Foundation.\n+# Later versions of the GPL at the discretion of Linus Torvalds\n+#\n+# Scan two git object-trees, and hardlink any common objects between them.\n+\n+use 5.006;\n+use strict;\n+use warnings;\n+\n+sub get_canonical_form($);\n+sub do_scan_directory($$$);\n+sub compare_two_files($$);\n+\n+# stats\n+my $linked = 0;\n+my $already = 0;\n+\n+my ($dir1, $dir2) = @ARGV;\n+\n+if (!defined $dir1 || !defined $dir2) {\n+\tprint(\"Usage: $0 <dir1> <dir2>\\nBoth dir1 and dir2 should contain a .git/objects/ subdirectory.\\n\");\n+\texit(1);\n+}\n+\n+$dir1 = get_canonical_form($dir1);\n+$dir2 = get_canonical_form($dir2);\n+\n+printf(\"Searching '%s' and '%s' for common objects and hardlinking them...\\n\",$dir1,$dir2);\n+\n+opendir(D,$dir1 . \"objects/\")\n+\tor die \"Failed to open $dir1/objects/ : $!\";\n+\n+my @hashdirs = grep !/^\\.{1,2}$/, readdir(D);\n+foreach my $hashdir (@hashdirs) {\n+\tdo_scan_directory($dir1, $hashdir, $dir2);\n+}\n+\n+printf(\"Linked %d files, %d were already linked.\\n\",$linked, $already);\n+\n+\n+sub do_scan_directory($$$) {\n+\tmy ($srcdir, $subdir, $dstdir) = @_;\n+\n+\tmy $sfulldir = sprintf(\"%sobjects/%s/\",$srcdir,$subdir);\n+\tmy $dfulldir = sprintf(\"%sobjects/%s/\",$dstdir,$subdir);\n+\n+\topendir(S,$sfulldir)\n+\t\tor die \"Failed to opendir $sfulldir: $!\";\n+\n+\tforeach my $file (grep(!/\\.{1,2}$/, readdir(S))) {\n+\t\tmy $sfilename = $sfulldir . $file;\n+\t\tmy $dfilename = $dfulldir . $file;\n+\n+\t\tcompare_two_files($sfilename,$dfilename);\n+\n+\t}\n+\tclosedir(S);\n+}\n+\n+sub compare_two_files($$) {\n+\tmy ($sfilename, $dfilename) = @_;\n+\n+\t# Perl's stat returns relevant information as follows:\n+\t# 0 = dev number\n+\t# 1 = inode number\n+\t# 7 = size\n+\tmy @sstatinfo = stat($sfilename);\n+\tmy @dstatinfo = stat($dfilename);\n+\n+\tif (@sstatinfo == 0 && @dstatinfo == 0) {\n+\t\tdie sprintf(\"Stat of both %s and %s failed: %s\\n\",$sfilename, $dfilename, $!);\n+\n+\t} elsif (@dstatinfo == 0) {\n+\t\treturn;\n+\t}\n+\n+\tif ( ($sstatinfo[0] == $dstatinfo[0]) &&\n+\t     ($sstatinfo[1] != $dstatinfo[1])) {\n+\t\tif ($sstatinfo[7] == $dstatinfo[7]) {\n+\t\t\tunlink($dfilename)\n+\t\t\t\tor die \"Unlink of $dfilename failed: $!\\n\";\n+\n+\t\t\tlink($sfilename,$dfilename)\n+\t\t\t\tor die \"Failed to link $sfilename to $dfilename: $!\\n\" .\n+\t\t\t\t\t\"Git Repository containing $dfilename is probably corrupted, please copy '$sfilename' to '$dfilename' to fix.\\n\";\n+\n+\t\t\t$linked++;\n+\n+\t\t} else {\n+\t\t\tdie sprintf(\"ERROR: File sizes are not the same, cannot relink %s to %s.\\n\",\n+\t\t\t\t$sfilename, $dfilename);\n+\t\t}\n+\n+\t} elsif ( ($sstatinfo[0] == $dstatinfo[0]) &&\n+\t     ($sstatinfo[1] == $dstatinfo[1])) {\n+\t\t$already++;\n+\t}\n+}\n+\n+sub get_canonical_form($) {\n+\tmy $dir = shift;\n+\tmy $original = $dir;\n+\n+\tdie \"$dir is not a directory.\" unless -d $dir;\n+\n+\t$dir .= \"/\" unless $dir =~ m#/$#;\n+\t$dir .= \".git/\" unless $dir =~ m#\\.git/$#;\n+\n+\tdie \"$original does not have a .git/ subdirectory.\\n\" unless -d $dir;\n+\n+\treturn $dir;\n+}\n\n\n\n-- \n\nRyan Anderson\n  sometimes Pug Majere\n"}]}