Skip path replacement when it would be a no-op
This commit is contained in:
parent
0224bce9f6
commit
d6a94eb452
@ -64,6 +64,7 @@ class Keg
|
|||||||
# some_variable="/opt/homebrew/Cellar/foo/1.0/lib"
|
# some_variable="/opt/homebrew/Cellar/foo/1.0/lib"
|
||||||
# and add quotes to protect against paths containing spaces.
|
# and add quotes to protect against paths containing spaces.
|
||||||
def replace_pkgconfig_file_path(s, old, new)
|
def replace_pkgconfig_file_path(s, old, new)
|
||||||
|
return if old == new
|
||||||
s.gsub!(%r[([\S]+)="?#{Regexp.escape(old)}(.*?)"?$], "\\1=\"#{new}\\2\"")
|
s.gsub!(%r[([\S]+)="?#{Regexp.escape(old)}(.*?)"?$], "\\1=\"#{new}\\2\"")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user