Commit 9e71add2 authored by Joshua Kalpin's avatar Joshua Kalpin

Merge pull request #1595 from Kapin/unreachable-repo-fix

[SourcesManager] Ignore repos with unreachable sources on update
parents a6a9f9ed 0feb5f1d
......@@ -17,6 +17,13 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Kevin Wales](https://github.com/kwales)
[#1562](https://github.com/CocoaPods/pull/1562)
* When updating the pod repos, repositories with unreachable remotes
are now ignored. This fixes an issue with certain private repositories.
[Joshua Kalpin](https://github.com/Kapin)
[#1595](https://github.com/CocoaPods/CocoaPods/pull/1595)
[#1571](https://github.com/CocoaPods/CocoaPods/issues/1571)
## 0.28.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.27.1...0.28.0)
[CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.27.1...0.28.0)
......
......@@ -145,7 +145,7 @@ module Pod
raise Informative, "The `#{source_name}` repo is not a git repo." unless git_repo?(specified_source.repo)
sources = [specified_source]
else
sources = aggregate.all.select { |source| git_repo?(source.repo) }
sources = aggregate.all.select { |source| git_repo?(source.repo) && git_remote_reachable?(source.repo) }
end
sources.each do |source|
......@@ -159,16 +159,28 @@ module Pod
end
end
# Returns whether a git repo's remote is reachable.
#
# @param [Pathname] dir
# The directory where the source is stored.
#
# @return [Bool] Whether the given source's remote is reachable.
#
def git_remote_reachable?(dir)
Dir.chdir(dir) { git('ls-remote') }
$?.success?
end
# Returns whether a source is a GIT repo.
#
# @param [Pathname] dir
# The directory where the source is stored.
#
# @return [Bool] Wether the given source is a GIT repo.
# @return [Bool] Whether the given source is a GIT repo.
#
def git_repo?(dir)
Dir.chdir(dir) { `git rev-parse >/dev/null 2>&1` }
$?.exitstatus.zero?
Dir.chdir(dir) { git('rev-parse >/dev/null 2>&1') }
$?.success?
end
# Checks the version information of the source with the given directory.
......
......@@ -95,6 +95,11 @@ module Pod
UI.output.should.match /Already up-to-date/
end
it 'returns whether a source has a reachable git remote' do
SourcesManager.git_remote_reachable?(repo_make('a_new_repo_that_is_new')).should.be.false
SourcesManager.git_remote_reachable?(SourcesManager.master_repo_dir).should.be.true
end
it "returns whether a source is backed by a git repo" do
SourcesManager.git_repo?(SourcesManager.master_repo_dir).should.be.true
SourcesManager.git_repo?(Pathname.new('/tmp')).should.be.false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment