aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJosh Hagins2016-11-01 15:21:13 -0400
committerGitHub2016-11-01 15:21:13 -0400
commitf14a3a17decdcfd26fc9f2dc0958ee642241ea5a (patch)
treeb8845ac321b26b7e86400f391829df4ab230b966 /Library/Homebrew
parent8d5df2ea8769f48fc8b9c145abc8fc1329a650cb (diff)
parente57d312ad1caa09ca0cd7cc4727dfd4b247d9971 (diff)
downloadbrew-f14a3a17decdcfd26fc9f2dc0958ee642241ea5a.tar.bz2
Merge pull request #1420 from jawshooah/fix-relocate
keg_relocate: include hard links and fix replacement ordering
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/keg_relocate.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index 41686b1bb..0ab4b9731 100644
--- a/Library/Homebrew/keg_relocate.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -66,11 +66,18 @@ class Keg
relocation.old_repository => relocation.new_repository,
}
- regexp = Regexp.union(replacements.keys)
+ # Order matters here since `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are
+ # children of `HOMEBREW_PREFIX` by default.
+ regexp = Regexp.union(
+ relocation.old_cellar,
+ relocation.old_repository,
+ relocation.old_prefix
+ )
+
changed = s.gsub!(regexp, replacements)
next unless changed
- changed_files << first.relative_path_from(path)
+ changed_files += [first, *rest].map { |file| file.relative_path_from(path) }
begin
first.atomic_write(s)