Method: Rugged::SubmoduleCollection#add

Defined in:
lib/rugged/submodule_collection.rb

#add(url, path, options = {}) ⇒ Object

call-seq:

submodules.setup_add(url, path[, options]) -> submodule

Add a new submodule.

This does "git submodule add" incuding fetch and checkout of the submodule contents.

  • url: URL for the submodule’s remote

  • path: path at which the submodule should be created

The options hash accepts all options supported by Rugged::Remote#fetch and the following:

:gitlink

(defaults to true) should workdir contain a gitlink to the repository in .git/modules vs. repository directly in workdir.

Returns the newly created submodule



28
29
30
31
32
# File 'lib/rugged/submodule_collection.rb', line 28

def add(url, path, options = {})
  submodule = setup_add(url, path, **options)
  clone_submodule(submodule.repository, **options)
  submodule.finalize_add
end