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:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user