{"thread":{"id":"28844","subject":"share object storage for multiple clones of different repositories","startedAt":"2011-11-04T23:10:18Z","lastAt":"2011-11-05T16:20:25Z","messageCount":5,"participants":["Gelonida N","Junio C Hamano","Frans Klaver"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"178860","messageId":"j91rcq$1uo$1@dough.gmane.org","threadId":"28844","inReplyTo":null,"subject":"share object storage for multiple clones of different repositories","fromName":"Gelonida N","fromEmail":"gelonida@gmail.com","sentAt":"2011-11-04T23:10:18Z","receivedAt":"2011-11-04T23:10:18Z","isPatch":false,"sender":{"key":"gelonida@gmail.com","avatar":null},"body":"Hi,\n\n(Thunderbird frozewhile sending my previous message so here a resend)\n\n\nI wondered whether it is possible, that all of my git repository clones\nshare the same object storage whether they are cloned from they same\nremote repository or not.\n\nIn my case this might save a lot of diskspace and accelerate cloning\nas some huge files are part of several repositories' history and as I'd\nlike to clone the same repository multiple times in order to have\nparallel working directories for parallel tests on different versions /\nbranches / tags\n\nFurther this might reduce clone times.\n\n\n\nMy goal would be to:\n- reduce disk space\n- reduce clone time, as objects would be taken from the existing shared\n  object storage\n\nIf possible it would be great if also all new created shared objects\nwould end up in the new object storage.\n\n\nIf git doesn't support this natively, then would following approach work\nfor reducing the disk space (clone time would not be reduced though)\n\n\n\nSHARED_STORAGE=$HOME/shared_storage\nmkdir $SHARED_STORAGE\n\ngit clone remotehost1:repo1\ncd repo1\nrsync -av .git/objects $SHARED_REPO\nrm -rf .git/objects\nln -s $SHARED_REPO/objects .git/\n\n\ngit clone remotehost2:repo2\ncd repo2\nrsync -av .git/objects $SHARED_REPO\nrm -rf .git/objects\nln -s $SHARED_REPO/objects .git/\n\nThanks for any feedback or other suggestions.\n"},{"id":"178865","messageId":"7vobwr9uf0.fsf@alter.siamese.dyndns.org","threadId":"28844","inReplyTo":"j91rcq$1uo$1@dough.gmane.org","subject":"Re: share object storage for multiple clones of different repositories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-05T02:26:11Z","receivedAt":"2011-11-05T02:26:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gelonida N <gelonida@gmail.com> writes:\n\n> SHARED_STORAGE=$HOME/shared_storage\n> mkdir $SHARED_STORAGE\n>\n> git clone remotehost1:repo1\n> cd repo1\n> rsync -av .git/objects $SHARED_REPO\n\nUp to this part it is probably OK.  Repeat that for all your local\nrepositories to collect all objects in $HOME/shared_storage.\n\nAfter doing that, do this in all of your local repositories:\n\n\trm -rf .git/objects\n        mkdir -p .git/objects/info\n        echo $HOME/shared/storage >.git/objects/info/alternates\n\nThe reason why nobody should follow your original recipe is because any\n\"git gc\"/\"git repack\" in any of your local repositories would break others\nwith that approach.\n"},{"id":"178885","messageId":"op.v4gp4mai0aolir@keputer.lokaal","threadId":"28844","inReplyTo":"7vobwr9uf0.fsf@alter.siamese.dyndns.org","subject":"Re: share object storage for multiple clones of different repositories","fromName":"Frans Klaver","fromEmail":"fransklaver@gmail.com","sentAt":"2011-11-05T07:37:24Z","receivedAt":"2011-11-05T07:37:24Z","isPatch":false,"sender":{"key":"fransklaver@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1876483?v=4"},"body":"On Sat, 05 Nov 2011 03:26:11 +0100, Junio C Hamano <gitster@pobox.com>  \nwrote:\n\n> Gelonida N <gelonida@gmail.com> writes:\n>\n>> SHARED_STORAGE=$HOME/shared_storage\n>> mkdir $SHARED_STORAGE\n>>\n>> git clone remotehost1:repo1\n>> cd repo1\n>> rsync -av .git/objects $SHARED_REPO\n>\n> Up to this part it is probably OK.  Repeat that for all your local\n> repositories to collect all objects in $HOME/shared_storage.\n>\n> After doing that, do this in all of your local repositories:\n>\n> \trm -rf .git/objects\n>         mkdir -p .git/objects/info\n>         echo $HOME/shared/storage >.git/objects/info/alternates\n>\n> The reason why nobody should follow your original recipe is because any\n> \"git gc\"/\"git repack\" in any of your local repositories would break  \n> others\n> with that approach.\n\n\nAlternatively there's the git-new-workdir script in contrib/workdir in  \ngit.git. Haven't tested it, but it seems like it does what you want.\n\nFrans\n"},{"id":"178907","messageId":"j93mu2$ce7$1@dough.gmane.org","threadId":"28844","inReplyTo":"op.v4gp4mai0aolir@keputer.lokaal","subject":"Re: share object storage for multiple clones of different repositories","fromName":"Gelonida N","fromEmail":"gelonida@gmail.com","sentAt":"2011-11-05T16:06:26Z","receivedAt":"2011-11-05T16:06:26Z","isPatch":false,"sender":{"key":"gelonida@gmail.com","avatar":null},"body":"Thanks for both of your replies,\n\n\nI'll probably mix both approaches and try out how it works.\nI didn't know about git.git\nWhat is the best url for an intrudoction into git.git?\n\n\n\n\nOn 11/05/2011 08:37 AM, Frans Klaver wrote:\n> On Sat, 05 Nov 2011 03:26:11 +0100, Junio C Hamano <gitster@pobox.com>\n> wrote:\n> \n>> Gelonida N <gelonida@gmail.com> writes:\n>>\n>>> SHARED_STORAGE=$HOME/shared_storage\n>>> mkdir $SHARED_STORAGE\n>>>\n>>> git clone remotehost1:repo1\n>>> cd repo1\n>>> rsync -av .git/objects $SHARED_REPO\n>>\n>> Up to this part it is probably OK.  Repeat that for all your local\n>> repositories to collect all objects in $HOME/shared_storage.\n>>\n>> After doing that, do this in all of your local repositories:\n>>\n>>     rm -rf .git/objects\n>>         mkdir -p .git/objects/info\n>>         echo $HOME/shared/storage >.git/objects/info/alternates\n>>\n>> The reason why nobody should follow your original recipe is because any\n>> \"git gc\"/\"git repack\" in any of your local repositories would break\n>> others\n>> with that approach.\n> \n> \n> Alternatively there's the git-new-workdir script in contrib/workdir in\n> git.git. Haven't tested it, but it seems like it does what you want.\n> \n> Frans\n"},{"id":"178908","messageId":"j93no9$htt$1@dough.gmane.org","threadId":"28844","inReplyTo":"j93mu2$ce7$1@dough.gmane.org","subject":"Re: share object storage for multiple clones of different repositories","fromName":"Gelonida N","fromEmail":"gelonida@gmail.com","sentAt":"2011-11-05T16:20:25Z","receivedAt":"2011-11-05T16:20:25Z","isPatch":false,"sender":{"key":"gelonida@gmail.com","avatar":null},"body":"On 11/05/2011 05:06 PM, Gelonida N wrote:\n> Thanks for both of your replies,\n> \n> \n> I'll probably mix both approaches and try out how it works.\n> I didn't know about git.git\n> What is the best url for an intrudoction into git.git?\n> \n> \n>>\n>> Alternatively there's the git-new-workdir script in contrib/workdir in\n>> git.git. Haven't tested it, but it seems like it does what you want.\n>>\n>> Frans\n> \n> \n\nIn an installed git (at least on Ubuntu) the contrib directory can be\nfound at /usr/share/doc/git/contrib\n"}]}