diff options
author | Nick LaMuro <nicklamuro@gmail.com> | 2017-06-26 17:19:04 -0500 |
---|---|---|
committer | Nick LaMuro <nicklamuro@gmail.com> | 2017-06-29 11:32:32 -0500 |
commit | 3db89cafa715527ff0066efb38fdeec1f07119f1 (patch) | |
tree | 7d1f3c269d73e7e206a5a6c186365c3353ccd6d0 /lib/bundler/source | |
parent | a14b5c02da80dc74bdafc660f592c5c4d0c8740d (diff) | |
download | bundler-3db89cafa715527ff0066efb38fdeec1f07119f1.tar.gz |
Compare sources using source's root
When doing the following:
expand(other.original_path)
inside a Bundler::Source::Path instance, the `@root_path` from the
instance that is having eql? called on it, the other instance's
root_path. This, in obscure cases, can cause a bug when you are doing an
nested eval_gemfile or other calls when comparing the lockfile's locked
path sources to the Bundler.definition's path sources.
Creating the expanded_original_path method allows a public interface to
be made available (and doesn't mess with any exiting functionality) that
allows comparing the source path of one Source::Path's expand_path to
another, where each uses their own root_path to resolve their full path,
instead of sharing the base one and causing edge case bugs
Diffstat (limited to 'lib/bundler/source')
-rw-r--r-- | lib/bundler/source/path.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 99808d2ef2..b13f971858 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -65,7 +65,7 @@ module Bundler def eql?(other) return unless other.class == self.class - expand(@original_path) == expand(other.original_path) && + expanded_original_path == other.expanded_original_path && version == other.version end @@ -119,6 +119,10 @@ module Bundler instance_of?(Path) end + def expanded_original_path + @expanded_original_path ||= expand(original_path) + end + private def expanded_path |