{"thread":{"id":"3577","subject":"git clone does not work with GIT_OBJECT_DIRECTORY set","startedAt":"2006-03-06T01:21:15Z","lastAt":"2006-03-07T16:13:28Z","messageCount":5,"participants":["Benjamin LaHaise","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"17218","messageId":"20060306012115.GG20768@kvack.org","threadId":"3577","inReplyTo":null,"subject":"git clone does not work with GIT_OBJECT_DIRECTORY set","fromName":"Benjamin LaHaise","fromEmail":"bcrl@kvack.org","sentAt":"2006-03-06T01:21:15Z","receivedAt":"2006-03-06T01:21:15Z","isPatch":false,"sender":{"key":"bcrl@kvack.org","avatar":null},"body":"And another bug (linux-2.6.git was created with a clone of git://.../ \nwhile GIT_OBJECT_DIRECTORY was set):\n\n$ git clone linux-2.6.git bootcache.git\nfatal: '/home/bcrl/linux-2.6.git/.git': unable to chdir or not a git archive\nfatal: unexpected EOF\nclone-pack from '/home/bcrl/linux-2.6.git/.git' failed.\n$ \n\n\t\t-ben\n-- \n\"Time is of no importance, Mr. President, only life is important.\"\nDon't Email: <dont@kvack.org>.\n"},{"id":"17220","messageId":"7vmzg4cq6y.fsf@assigned-by-dhcp.cox.net","threadId":"3577","inReplyTo":"20060306012115.GG20768@kvack.org","subject":"Re: git clone does not work with GIT_OBJECT_DIRECTORY set","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-06T01:33:25Z","receivedAt":"2006-03-06T01:33:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Benjamin LaHaise <bcrl@kvack.org> writes:\n\n> And another bug (linux-2.6.git was created with a clone of git://.../ \n> while GIT_OBJECT_DIRECTORY was set):\n>\n> $ git clone linux-2.6.git bootcache.git\n> fatal: '/home/bcrl/linux-2.6.git/.git': unable to chdir or not a git archive\n> fatal: unexpected EOF\n> clone-pack from '/home/bcrl/linux-2.6.git/.git' failed.\n> $ \n\nPlease try it without GIT_OBJECT_DIRECTORY and see it works\ncorrectly (I think it should).  If that is the case, maybe\ngit-clone should explicitly unset GIT_OBJECT_DIRECTORY.\n"},{"id":"17222","messageId":"20060306013854.GH20768@kvack.org","threadId":"3577","inReplyTo":"7vmzg4cq6y.fsf@assigned-by-dhcp.cox.net","subject":"Re: git clone does not work with GIT_OBJECT_DIRECTORY set","fromName":"Benjamin LaHaise","fromEmail":"bcrl@kvack.org","sentAt":"2006-03-06T01:38:54Z","receivedAt":"2006-03-06T01:38:54Z","isPatch":false,"sender":{"key":"bcrl@kvack.org","avatar":null},"body":"On Sun, Mar 05, 2006 at 05:33:25PM -0800, Junio C Hamano wrote:\n> Please try it without GIT_OBJECT_DIRECTORY and see it works\n> correctly (I think it should).  If that is the case, maybe\n> git-clone should explicitly unset GIT_OBJECT_DIRECTORY.\n\nNope.  There is no .git/objects directory, so how would it be able to \nfind the objects?\n\n\t\t-ben\n-- \n\"Time is of no importance, Mr. President, only life is important.\"\nDon't Email: <dont@kvack.org>.\n"},{"id":"17282","messageId":"7vu0aa4vj4.fsf@assigned-by-dhcp.cox.net","threadId":"3577","inReplyTo":"20060306013854.GH20768@kvack.org","subject":"Re: git clone does not work with GIT_OBJECT_DIRECTORY set","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-03-07T06:29:51Z","receivedAt":"2006-03-07T06:29:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Benjamin LaHaise <bcrl@kvack.org> writes:\n\n> On Sun, Mar 05, 2006 at 05:33:25PM -0800, Junio C Hamano wrote:\n>> Please try it without GIT_OBJECT_DIRECTORY and see it works\n>> correctly (I think it should).  If that is the case, maybe\n>> git-clone should explicitly unset GIT_OBJECT_DIRECTORY.\n>\n> Nope.  There is no .git/objects directory, so how would it be able to \n> find the objects?\n\nAh, I misunderstood what you were trying to do here.  What you\nmeant with this is:\n\n\t$ git clone linux-2.6.git bootcache.git\n\n* linux-2.6.git is a local directory with HEAD, refs/* and stuff\n  but does not have objects/.\n\n* bootcache.git is a local directory to be created anew.\n\nEven though linux-2.6.git does not have objects subdirectory, it\nis usually not a problem for you because you use GIT_OBJECT_DIRECTORY\nfor that.\n\nShort answer for this is: sorry, \"git clone\" barebone Porcelain\ndoes not support such a configuration if your source repository\nis local.  It works for destination, though:\n\n\t$ export GIT_OBJECT_DIRECTORY=/tmp/foobla \n\t$ git clone git://git.kernel.org/.../linux-2.6.git bootcache.git\n\nYou will get a single pack in /tmp/foobla/pack and would not\neven have bootcache.git/.git/objects directory.\n\nI should probably add that GIT_OBJECT_DIRECTORY environment\nvariable has outlived its usefulness.  Initially we added that\nflexibility without really knowing where it would lead us, but\nit has turned out that often we would want the refs and objects\ngo hand-in-hand.  Two or more repositories sharing the object\npool to save storage initially sounded a good idea, but that\nwould make fsck-objects cumbersome (you have to learn to ignore\ndangling warnings, which makes checking rather pointless), and\npacking less useful (you need to collect refs in all the\nrepositories that share the object pool).\n\nI think the recommended way these days to set up multiple\nrepositories that work on related projects is to set up a single\nclone from external source (e.g. linux-2.6.git), and make a set\nof local \"-l -s\" clones out of it, and then fetch forked\nupstreams into them.  It would go something like this:\n\n(initial setup)\n\t$ git clone --bare git://git.kernel.org/.../torvalds/linux-2.6.git \\\n          linux-2.6.git\n\n    (do this only once for each forked upstream)\n        $ git clone -l -s -n linux-2.6.git netdev-2.6\n\t$ cd netdev-2.6\n        $ ed .git/remotes/origin ;# adjust to jgarzik tree's location\n        $ mkdir .git/refs/stashed\n        $ mv .git/refs/heads .git/refs/tags .git/refs/stashed\n        $ mkdir .git/refs/heads .git/refs/tags\n\t$ git fetch -k \n        $ cp .git/refs/heads/origin .git/refs/heads/master\n        $ rm -fr .git/refs/stashed\n        $ git checkout\n        \n(update the shared master tree from time to time)\n\t$ cd linux-2.6.git\n        $ GIT_DIR=. git fetch-pack \\\n          git://git.kernel.org/.../torvalds/linux-2.6.git\n\n(working in the individual forked tree is just as usual)\n\t$ cd netdev-2.6\n        $ git fetch ;# or git pull\n\nI think the part for each forked upstream above that consists of\n10 or so commands above can be more or less automated.  The part\nthat needs human input is the adjusting of .git/remotes/origin,\nwhich depends on where each forked upstream tree is and what\nbranches there are of interest.\n"},{"id":"17301","messageId":"20060307161328.GA5410@kvack.org","threadId":"3577","inReplyTo":"7vu0aa4vj4.fsf@assigned-by-dhcp.cox.net","subject":"Re: git clone does not work with GIT_OBJECT_DIRECTORY set","fromName":"Benjamin LaHaise","fromEmail":"bcrl@kvack.org","sentAt":"2006-03-07T16:13:28Z","receivedAt":"2006-03-07T16:13:28Z","isPatch":false,"sender":{"key":"bcrl@kvack.org","avatar":null},"body":"On Mon, Mar 06, 2006 at 10:29:51PM -0800, Junio C Hamano wrote:\n> I think the recommended way these days to set up multiple\n> repositories that work on related projects is to set up a single\n> clone from external source (e.g. linux-2.6.git), and make a set\n> of local \"-l -s\" clones out of it, and then fetch forked\n> upstreams into them.  It would go something like this:\n\nI had been doing that, but it's gotten too painful to keep everything in \nsync.  Sigh.\n\n\t\t-ben\n-- \n\"Time is of no importance, Mr. President, only life is important.\"\nDon't Email: <dont@kvack.org>.\n"}]}