JuliaLang/julia — pull request #1746 by timholy (2012-12-13 12:38:06+00:00)
Title: RFC: Fix pkg.clone()

Creating a new package is not yet as simple as we'd like. The "recipe" I wrote here:
https://github.com/JuliaLang/METADATA.jl#recipe-for-packaging-an-existing-repository
doesn't quite work (see https://github.com/JuliaLang/METADATA.jl/commit/b46f059c84c579fd3805f34be903b7a10586b1b7#commitcomment-2297864). It turns out the reason is that it's not registered as a submodule, and that in `_resolve()` the directory was not being included in the call to `Git.each_submodule`.

To me it seems that the cleanest path forward is through `Pkg.clone()`. A comment in `pkg.jl` indicates that it is currently broken, so I took a stab at fixing it. I am no git wizard, so I'm sure I've made some mistakes here, hence the RFC. But for me it seemed to work. The two key steps were to add a second input argument (previously it was trying to clone into `.julia`, which causes an error) and to use `git submodule add`.