Skip to content

Commit

Permalink
Merge pull request #193 from jhawthorn/reuse_expanded_path
Browse files Browse the repository at this point in the history
Reuse expanded_path when generating index
  • Loading branch information
burke authored Sep 5, 2018
2 parents 4c2ec2b + 9e17729 commit 3851a33
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/bootsnap/load_path_cache/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ def push_paths_locked(*paths)
p = Path.new(path)
@has_relative_paths = true if p.relative?
next if p.non_directory?
expanded_path = p.expanded_path
entries, dirs = p.entries_and_dirs(@store)
# push -> low precedence -> set only if unset
dirs.each { |dir| @dirs[dir] ||= true }
entries.each { |rel| @index[rel] ||= p.expanded_path }
entries.each { |rel| @index[rel] ||= expanded_path }
end
end
end
Expand All @@ -145,10 +146,11 @@ def unshift_paths_locked(*paths)
paths.map(&:to_s).reverse_each do |path|
p = Path.new(path)
next if p.non_directory?
expanded_path = p.expanded_path
entries, dirs = p.entries_and_dirs(@store)
# unshift -> high precedence -> unconditional set
dirs.each { |dir| @dirs[dir] = true }
entries.each { |rel| @index[rel] = p.expanded_path }
entries.each { |rel| @index[rel] = expanded_path }
end
end
end
Expand Down

0 comments on commit 3851a33

Please sign in to comment.