{"thread":{"id":"20300","subject":"git clone ignores GIT_ALTERNATE_OBJECT_DIRECTORIES","startedAt":"2009-07-30T17:58:33Z","lastAt":"2009-07-31T12:55:39Z","messageCount":3,"participants":["Brian Ristuccia","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"119185","messageId":"20090730175833.GV12813@osiris.978.org","threadId":"20300","inReplyTo":null,"subject":"git clone ignores GIT_ALTERNATE_OBJECT_DIRECTORIES","fromName":"Brian Ristuccia","fromEmail":"brian@ristuccia.com","sentAt":"2009-07-30T17:58:33Z","receivedAt":"2009-07-30T17:58:33Z","isPatch":false,"sender":{"key":"brian@ristuccia.com","avatar":null},"body":"When running git clone, it seems that GIT_ALTERNATE_OBJECT_DIRECTORIES is\nnot considered. Even though most of the needed objects are in\nGIT_ALTERNATE_OBJECT_DIRECTORIES, I still wind up with a ton of traffic over\nthe network and a huge .git/objects hierarchy.\n\nRunning \"git gc\" later pares down the .git/objects to a more reasonable\nsize, so it seems the problem is limited to git clone. Using \"git clone\n--reference\" also seems to do the right thing.\n\nIs this behavior intentional for some good reason I've overlooked, or have I\nstumbled on a bug?\n\n-- \nBrian Ristuccia\nbrian@ristuccia.com\n"},{"id":"119190","messageId":"7vab2maqeo.fsf@alter.siamese.dyndns.org","threadId":"20300","inReplyTo":"20090730175833.GV12813@osiris.978.org","subject":"Re: git clone ignores GIT_ALTERNATE_OBJECT_DIRECTORIES","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-07-30T20:04:31Z","receivedAt":"2009-07-30T20:04:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brian Ristuccia <brian@ristuccia.com> writes:\n\n> Is this behavior intentional for some good reason I've overlooked, or have I\n> stumbled on a bug?\n\nMost likely not a bug.\n\nWhen you talk about \"clone\", you need to realize that there actually are\ntwo repositories (and two object databases) involved: cloned source and\ndestination.\n\nWhich repository should GIT_ALTERNATE_OBJECT_DIRECTORIES affect?\n\nIf you are making a clone from a remote over the network, and if you\nalready have another local repository of a related project that has\nnecessary objects, you may want to look at\n\n    \"git clone --reference\"\n"},{"id":"119266","messageId":"20090731125539.GX12813@osiris.978.org","threadId":"20300","inReplyTo":"7vab2maqeo.fsf@alter.siamese.dyndns.org","subject":"Re: git clone ignores GIT_ALTERNATE_OBJECT_DIRECTORIES","fromName":"Brian Ristuccia","fromEmail":"brian@ristuccia.com","sentAt":"2009-07-31T12:55:39Z","receivedAt":"2009-07-31T12:55:39Z","isPatch":false,"sender":{"key":"brian@ristuccia.com","avatar":null},"body":"On Thu, Jul 30, 2009 at 01:04:31PM -0700, Junio C Hamano wrote:\n> Brian Ristuccia <brian@ristuccia.com> writes:\n> \n> > Is this behavior intentional for some good reason I've overlooked, or have I\n> > stumbled on a bug?\n> \n> Most likely not a bug.\n> \n> When you talk about \"clone\", you need to realize that there actually are\n> two repositories (and two object databases) involved: cloned source and\n> destination.\n> \n> Which repository should GIT_ALTERNATE_OBJECT_DIRECTORIES affect?\n> \n\nWhichever one git is currently working in. (Even if git picks the \"wrong\"\nrepository, object f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 is still\nf1d2d2f924e986ac86fdf7b36c94bcdf32beec15 regardless of which repo it appears\nin and the end result will be consistent). \n\nMy understanding after reading gitrepository-layout(5), git-fsck(1),  is\nthat the effect of listing a directory in GIT_ALTERNATE_OBJECT_DIRECTORIES\nshould be roughly the same as listing it in the .git/objects/info/alternates\nof whatever repository git happens to be working on.\n   \n> If you are making a clone from a remote over the network, and if you\n> already have another local repository of a related project that has\n> necessary objects, you may want to look at\n> \n>     \"git clone --reference\"\n> \n\nYes, this does the right thing as I mentioned in my previous message.\n(Behind the scenes, it's setting up .git/objects/info/alternates). My\nquestion is why doesn't GIT_ALTERNATE_OBJECT_DIRECTORIES behave the same as\n.git/objects/info/alternatives in all cases?\n\n-- \nBrian Ristuccia\nbrian@ristuccia.com\n"}]}