class Rugged::SubmoduleCollection
def add(url, path, options = {})
directly in workdir.
gitlink to the repository in +.git/modules+ vs. repository
(defaults to +true+) should workdir contain a
:gitlink ::
and the following:
The +options+ hash accepts all options supported by Rugged::Remote#fetch
- +path+: path at which the submodule should be created
- +url+: URL for the submodule's remote
submodule contents.
This does "git submodule add" incuding fetch and checkout of the
Add a new +submodule+.
submodules.setup_add(url, path[, options]) -> submodule
call-seq:
def add(url, path, options = {}) submodule = setup_add(url, path, **options) clone_submodule(submodule.repository, **options) submodule.finalize_add end
def clone_submodule(repo, **fetch_options)
2. sets up a master branch to be tracking origin/master
1. fetches the remote
This provides a ghetto clone implementation that:
requires the target for the clone to be an empty dir.
with a workdir for the submodule. libgit2's `git_clone` however
currently libgit2's `git_submodule_add_setup` initializes a repo
def clone_submodule(repo, **fetch_options) # the remote was just added by setup_add, no need to check presence repo.remotes['origin'].fetch(**fetch_options) repo.branches.create('master','origin/master') repo.branches['master'].upstream = repo.branches['origin/master'] repo.checkout_head(strategy: :force) end