Method: Git::URL.clone_to
- Defined in:
- lib/git/url.rb
.clone_to(url, bare: false, mirror: false) ⇒ String
The directory git clone would use for the repository directory for the given URL
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/git/url.rb', line 64 def self.clone_to(url, bare: false, mirror: false) uri = parse(url) path_parts = uri.path.split('/') path_parts.pop if path_parts.last == '.git' directory = path_parts.last if || mirror directory += '.git' unless directory.end_with?('.git') elsif directory.end_with?('.git') directory = directory[0..-5] end directory end |