Skip to content

Commit

Permalink
Submodule command.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis authored and defunkt committed Mar 3, 2010
1 parent a8e04cb commit 3a0b1dd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/hub/commands.rb
Expand Up @@ -87,6 +87,18 @@ def clone(args)
end
end

# $ hub submodule add wycats/bundler vendor/bundler
# > git submodule add git://github.com/wycats/bundler.git vendor/bundler
#
# $ hub submodule add -p wycats/bundler vendor/bundler
# > git submodule add git@github.com:wycats/bundler.git vendor/bundler
def submodule(args)
return unless index = args.index('add')
args.delete_at index
clone(args)
args.insert index, 'add'
end

# $ hub remote add pjhyett
# > git remote add pjhyett git://github.com/pjhyett/THIS_REPO.git
#
Expand Down
15 changes: 15 additions & 0 deletions test/hub_test.rb
Expand Up @@ -90,6 +90,21 @@ def test_private_remote_origin
assert_command input, command
end

def test_public_submodule
input = "submodule add wycats/bundler vendor/bundler"
command = "git submodule add git://github.com/wycats.bundler.git"
end

def test_private_submodule
input = "submodule add -p grit vendor/grit"
command = "git submodule add git@github.com:tpw/grit.git"
end

def test_submodule_with_args
input = "submodule -q add --bare -- grit grit"
command = "git submodule -q add --bare -- git://github.com/tpw/grit.git grit"
end

def test_private_remote
input = "remote add -p rtomayko"
command = "git remote add rtomayko git@github.com:rtomayko/hub.git"
Expand Down

0 comments on commit 3a0b1dd

Please sign in to comment.