Don't try to clone uri's without a corresponding destination

The code throws the exception

  undefined method `join' for nil:NilClass

if destionation doesn't exist - so it's better to not call git_clone if
destination is not present.
This commit is contained in:
Jacob Atzen
2010-08-17 10:04:59 +02:00
parent 546f078f99
commit 0440cd672d
2 changed files with 22 additions and 5 deletions

View File

@@ -27,12 +27,11 @@ class Homesick < Thor
elsif uri =~ GITHUB_NAME_REPO_PATTERN
destination = Pathname.new($1)
git_clone "git://github.com/#{$1}.git", :destination => destination
else
if uri =~ /\/([^\/]*).git\Z/
destination = Pathname.new($1)
end
elsif uri =~ /\/([^\/]*)(\.git)?\Z/
destination = Pathname.new($1)
git_clone uri
else
raise "Unknown URI format: #{uri}"
end
if destination.join('.gitmodules').exist?