This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
6761: fix error with path objects in array r=greysteil a=alexggordon Thanks so much for the contribution! To make reviewing this PR a bit easier, please fill out answers to the following questions. ### What was the end-user problem that led to this PR? The problem was that `Pathname` instances in an array can not be sorted when there are string instances in the array also. Because of this, calling `.sort` before `.to_s` resulted in the error ``` [!] There was an error parsing `Gemfile`: comparison of Pathname with String failed. Bundler cannot continue. ``` you can easily see this issue doing ``` > require 'rails' => true > [Pathname.new("/tmp/bundle")] => [#<Pathname:/tmp/bundle>] > [Pathname.new("/tmp/bundle"), "test"] => [#<Pathname:/tmp/bundle>, "test"] > [Pathname.new("/tmp/bundle"), "test"].sort ArgumentError: comparison of Pathname with String failed ``` ### What was your diagnosis of the problem? `sort` was called before `map` in the warn message. ### What is your fix for the problem, implemented in this PR? We should call `map(&:to_s)` before calling sort, and add a test case for this scenario. ### Why did you choose this fix out of the possible options? Because it broke our production deploys. Co-authored-by: Alex Gordon <agordon@sessionm.com>
- Loading branch information