Commit 1c0966d6 authored by Samuel Giddins's avatar Samuel Giddins

Merge pull request #5140 from soutaro/sort-glob-result

Sort Dir.glob result in PathList case insensitively
parents 6d77bb48 742cab3c
......@@ -25,7 +25,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* None.
* Sort files from Dir.glob explicitly to produce same result on case sensitive
file system as result on case insensitive file system.
[Soutaro Matsumoto](https://github.com/soutaro)
## 1.0.0.beta.6 (2016-03-15)
......
......@@ -49,7 +49,7 @@ module Pod
end
root_length = root.to_s.length + 1
escaped_root = escape_path_for_glob(root)
paths = Dir.glob(escaped_root + '**/*', File::FNM_DOTMATCH)
paths = Dir.glob(escaped_root + '**/*', File::FNM_DOTMATCH).sort_by(&:upcase)
absolute_dirs = paths.select { |path| File.directory?(path) }
relative_dirs = absolute_dirs.map { |p| p[root_length..-1] }
absolute_paths = paths.reject { |p| p == "#{root}/." || p == "#{root}/.." }
......
......@@ -166,6 +166,20 @@ module Pod
end
end
describe 'Reading file system' do
it 'orders paths case insensitively' do
root = fixture('banana-lib')
# Let Dir.glob result be ordered case-sensitively
Dir.stubs(:glob).returns(["#{root}/Classes/NSFetchRequest+Banana.h",
"#{root}/Classes/NSFetchedResultsController+Banana.h"])
File.stubs(:directory?).returns(false)
path_list = Sandbox::PathList.new(fixture('banana-lib'))
path_list.files.should == %w(Classes/NSFetchedResultsController+Banana.h Classes/NSFetchRequest+Banana.h)
end
end
#-------------------------------------------------------------------------#
describe 'Private Helpers' do
......
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