{"thread":{"id":"37652","subject":"Submodules and GIT_ALTERNATE_OBJECT_DIRECTORIES","startedAt":"2014-09-30T13:25:13Z","lastAt":"2014-10-04T18:03:51Z","messageCount":4,"participants":["Michal Sojka","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"250043","messageId":"878ul19r5y.fsf@steelpick.2x.cz","threadId":"37652","inReplyTo":null,"subject":"Submodules and GIT_ALTERNATE_OBJECT_DIRECTORIES","fromName":"Michal Sojka","fromEmail":"sojkam1@fel.cvut.cz","sentAt":"2014-09-30T13:25:13Z","receivedAt":"2014-09-30T13:25:13Z","isPatch":false,"sender":{"key":"sojkam1@fel.cvut.cz","avatar":"https://avatars.githubusercontent.com/u/140542?v=4"},"body":"Hi list,\n\nI'd like to shorten the time needed by our continuous integration (CI)\ntool to clone the source repositories. Currently the full clone takes\nabout 10 minutes (even from local server). Our main repository has\nseveral submodules so the CI tool runs \"git submodule update --init\". My\nidea was to use GIT_ALTERNATE_OBJECT_DIRECTORIES to cache objects from\nseveral submodule repositories locally. However, this does not work\nbecause GIT_ALTERNATE_OBJECT_DIRECTORIES is considered local to the\nsuper-project and is not propagated to the \"git clone\" for submodules\n(git-submodule.sh calls clear_local_git_env).\n\nMy question is why is GIT_ALTERNATE_OBJECT_DIRECTORIES considered local\nto the repository? If I could modify the command-line I would use the\n\"git submodule update\" with the --reference option, which is propagated\nto clones of all submodules. Letting GIT_ALTERNATE_OBJECT_DIRECTORIES\npropagate to the submodules should have the same effect as --reference\noption. So why it is not propagated?\n\nThanks,\n-Michal\n"},{"id":"250197","messageId":"542E85B5.3020101@web.de","threadId":"37652","inReplyTo":"878ul19r5y.fsf@steelpick.2x.cz","subject":"Re: Submodules and GIT_ALTERNATE_OBJECT_DIRECTORIES","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2014-10-03T11:17:09Z","receivedAt":"2014-10-03T11:17:09Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 30.09.2014 um 15:25 schrieb Michal Sojka:\n> I'd like to shorten the time needed by our continuous integration (CI)\n> tool to clone the source repositories. Currently the full clone takes\n> about 10 minutes (even from local server). Our main repository has\n> several submodules so the CI tool runs \"git submodule update --init\". My\n> idea was to use GIT_ALTERNATE_OBJECT_DIRECTORIES to cache objects from\n> several submodule repositories locally. However, this does not work\n> because GIT_ALTERNATE_OBJECT_DIRECTORIES is considered local to the\n> super-project and is not propagated to the \"git clone\" for submodules\n> (git-submodule.sh calls clear_local_git_env).\n >\n> My question is why is GIT_ALTERNATE_OBJECT_DIRECTORIES considered local\n> to the repository? If I could modify the command-line I would use the\n> \"git submodule update\" with the --reference option, which is propagated\n> to clones of all submodules. Letting GIT_ALTERNATE_OBJECT_DIRECTORIES\n> propagate to the submodules should have the same effect as --reference\n> option. So why it is not propagated?\n\nBecause then it would /always/ propagate? So while that would have the\nsame effect as using the --reference option, not using the --reference\noption would behave differently, no?\n"},{"id":"250198","messageId":"87tx3l4ban.fsf@steelpick.2x.cz","threadId":"37652","inReplyTo":"542E85B5.3020101@web.de","subject":"Re: Submodules and GIT_ALTERNATE_OBJECT_DIRECTORIES","fromName":"Michal Sojka","fromEmail":"sojkam1@fel.cvut.cz","sentAt":"2014-10-03T11:56:00Z","receivedAt":"2014-10-03T11:56:00Z","isPatch":false,"sender":{"key":"sojkam1@fel.cvut.cz","avatar":"https://avatars.githubusercontent.com/u/140542?v=4"},"body":"On Fri, Oct 03 2014, Jens Lehmann wrote:\n> Am 30.09.2014 um 15:25 schrieb Michal Sojka:\n>> I'd like to shorten the time needed by our continuous integration (CI)\n>> tool to clone the source repositories. Currently the full clone takes\n>> about 10 minutes (even from local server). Our main repository has\n>> several submodules so the CI tool runs \"git submodule update --init\". My\n>> idea was to use GIT_ALTERNATE_OBJECT_DIRECTORIES to cache objects from\n>> several submodule repositories locally. However, this does not work\n>> because GIT_ALTERNATE_OBJECT_DIRECTORIES is considered local to the\n>> super-project and is not propagated to the \"git clone\" for submodules\n>> (git-submodule.sh calls clear_local_git_env).\n>  >\n>> My question is why is GIT_ALTERNATE_OBJECT_DIRECTORIES considered local\n>> to the repository? If I could modify the command-line I would use the\n>> \"git submodule update\" with the --reference option, which is propagated\n>> to clones of all submodules. Letting GIT_ALTERNATE_OBJECT_DIRECTORIES\n>> propagate to the submodules should have the same effect as --reference\n>> option. So why it is not propagated?\n>\n> Because then it would /always/ propagate? So while that would have the\n> same effect as using the --reference option, not using the --reference\n> option would behave differently, no?\n\nThat's a good reason, thanks. Fortunately, I found a way how to add\n--reference to the submodule update command issued by the CI tool\n(Bamboo). Instead of calling git directly, the CI tool calls my \"git\"\nscript, which modifies the command line in case of \"submodule update\"\nand then calls the real git.\n\nBest regards,\n-Michal\n"},{"id":"250249","messageId":"54303687.5020006@web.de","threadId":"37652","inReplyTo":"87tx3l4ban.fsf@steelpick.2x.cz","subject":"Re: Submodules and GIT_ALTERNATE_OBJECT_DIRECTORIES","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2014-10-04T18:03:51Z","receivedAt":"2014-10-04T18:03:51Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 03.10.2014 um 13:56 schrieb Michal Sojka:\n> On Fri, Oct 03 2014, Jens Lehmann wrote:\n>> Am 30.09.2014 um 15:25 schrieb Michal Sojka:\n>>> I'd like to shorten the time needed by our continuous integration (CI)\n>>> tool to clone the source repositories. Currently the full clone takes\n>>> about 10 minutes (even from local server). Our main repository has\n>>> several submodules so the CI tool runs \"git submodule update --init\". My\n>>> idea was to use GIT_ALTERNATE_OBJECT_DIRECTORIES to cache objects from\n>>> several submodule repositories locally. However, this does not work\n>>> because GIT_ALTERNATE_OBJECT_DIRECTORIES is considered local to the\n>>> super-project and is not propagated to the \"git clone\" for submodules\n>>> (git-submodule.sh calls clear_local_git_env).\n>>   >\n>>> My question is why is GIT_ALTERNATE_OBJECT_DIRECTORIES considered local\n>>> to the repository? If I could modify the command-line I would use the\n>>> \"git submodule update\" with the --reference option, which is propagated\n>>> to clones of all submodules. Letting GIT_ALTERNATE_OBJECT_DIRECTORIES\n>>> propagate to the submodules should have the same effect as --reference\n>>> option. So why it is not propagated?\n>>\n>> Because then it would /always/ propagate? So while that would have the\n>> same effect as using the --reference option, not using the --reference\n>> option would behave differently, no?\n>\n> That's a good reason, thanks. Fortunately, I found a way how to add\n> --reference to the submodule update command issued by the CI tool\n> (Bamboo). Instead of calling git directly, the CI tool calls my \"git\"\n> script, which modifies the command line in case of \"submodule update\"\n> and then calls the real git.\n\nGood to hear that! In the CI tool we use at $dayjob (Jenkins) we do\nnot use the automatic submodule update provided by the Git plugin\nbut call submodule update in the shell execution before building it.\n"}]}