diff options
author | The Bundler Bot <bot@bundler.io> | 2018-07-29 05:01:20 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2018-07-29 05:01:20 +0000 |
commit | 42c4609e01c0869f5341f658d2a345a8969fa3e2 (patch) | |
tree | c6e21ab1e3b7a4ad3bbbd7069fbb910f22f495f9 | |
parent | 7b603f39e32a466cb1a8235a963968b2103e665e (diff) | |
parent | 10b98e7fdc037251346b7878cf50eb4044d01a20 (diff) | |
download | bundler-42c4609e01c0869f5341f658d2a345a8969fa3e2.tar.gz |
Auto merge of #6636 - ojab:1-16-stable, r=indirect
Don't call File.realpath in a loop, single call does what we want
### What was the end-user problem that led to this PR?
We're calling `File.realpath` in a loop
### What was your diagnosis of the problem?
Single call already resolves symlinks recursively
### What is your fix for the problem, implemented in this PR?
Drop call in a loop
-rw-r--r-- | lib/bundler/shared_helpers.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index b85e58ac66..7ff391ab60 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -351,13 +351,9 @@ module Bundler def resolve_path(path) expanded = File.expand_path(path) - return expanded unless File.respond_to?(:realpath) + return expanded unless File.respond_to?(:realpath) && File.exist?(expanded) - while File.exist?(expanded) && File.realpath(expanded) != expanded - expanded = File.realpath(expanded) - end - - expanded + File.realpath(expanded) end def prints_major_deprecations? |