aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/tap.rb5
-rw-r--r--Library/Homebrew/test/test_tap.rb3
2 files changed, 6 insertions, 2 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index 042f1af52..52e6136b6 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -188,7 +188,6 @@ class Tap
requested_remote = options[:clone_target] || "https://github.com/#{user}/homebrew-#{repo}"
if installed?
- raise TapRemoteMismatchError.new(name, @remote, requested_remote) unless remote == requested_remote
raise TapAlreadyTappedError, name unless full_clone
raise TapAlreadyUnshallowError, name unless shallow?
end
@@ -197,6 +196,10 @@ class Tap
Utils.ensure_git_installed!
if installed?
+ if options[:clone_target] && requested_remote != remote
+ raise TapRemoteMismatchError.new(name, @remote, requested_remote)
+ end
+
ohai "Unshallowing #{name}" unless quiet
args = %W[fetch --unshallow]
args << "-q" if quiet
diff --git a/Library/Homebrew/test/test_tap.rb b/Library/Homebrew/test/test_tap.rb
index a6b81dc95..94500babb 100644
--- a/Library/Homebrew/test/test_tap.rb
+++ b/Library/Homebrew/test/test_tap.rb
@@ -181,9 +181,10 @@ class TapTest < Homebrew::TestCase
def test_install_tap_remote_mismatch_error
setup_git_repo
already_tapped_tap = Tap.new("Homebrew", "foo")
+ touch @tap.path/".git/shallow"
assert_equal true, already_tapped_tap.installed?
wrong_remote = "#{@tap.remote}-oops"
- assert_raises(TapRemoteMismatchError) { already_tapped_tap.install :clone_target => wrong_remote }
+ assert_raises(TapRemoteMismatchError) { already_tapped_tap.install :clone_target => wrong_remote, :full_clone => true }
end
def test_install_tap_already_unshallow_error