From 4101cef3c5e167daee6a6189e34546619c510dd3 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sat, 13 Jun 2015 01:57:00 +0800 Subject: Tap: make remote a separate method to reduce initial overhead Also make remote method only response to installed tap. --- Library/Homebrew/cmd/tap-info.rb | 2 +- Library/Homebrew/cmd/tap.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index e05b9eb08..cd3f82109 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -48,7 +48,7 @@ module Homebrew info += "Not installed" end puts info - puts "From: #{tap.remote}" + puts "From: #{tap.remote.nil? ? "N/A" : tap.remote}" end end end diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 3a0a1156b..43e47711e 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -14,10 +14,11 @@ module Homebrew end def install_tap user, repo, clone_target=nil - tap = Tap.new user, repo, clone_target + tap = Tap.new user, repo return false if tap.installed? ohai "Tapping #{tap}" - args = %W[clone #{tap.remote} #{tap.path}] + remote = clone_target || "https://github.com/#{tap.user}/homebrew-#{tap.repo}" + args = %W[clone #{remote} #{tap.path}] args << "--depth=1" unless ARGV.include?("--full") safe_system "git", *args -- cgit v1.2.3