Permalink
Browse files

Set the parent repository up as an alternate for each submodule to cu…

…t down on storage requirements
  • Loading branch information...
1 parent 397b650 commit ffb2f51e8297245fd9ebd1df3a4f46875284a7b5 @dabrahams dabrahams committed Jan 15, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/submodule.cpp
View
@@ -32,6 +32,7 @@
#include "submodule.h"
#include "converter.h"
+#include <fstream>
Submodule::Submodule(std::string _pathname, ConvertRepository& _parent)
: pathname(_pathname), parent(_parent)
@@ -42,6 +43,11 @@ Submodule::Submodule(std::string _pathname, ConvertRepository& _parent)
std::system((std::string("git --git-dir=\"") +
pathname + "/.git\" init").c_str());
+ // Share as much storage with the parent repository as possible
+ std::ofstream((pathname + "/.git/objects/info/alternates").c_str())
+ << (parent.repository->dotgit_directory() / "objects").c_str()
+ << std::endl;
+
repository =
new Git::Repository(filesystem::system_complete(pathname),
parent.status, function<void(Git::CommitPtr)>

0 comments on commit ffb2f51

Please sign in to comment.