Return early from resolve_any_conflicts for non-symlinks
This commit is contained in:
parent
975f61d981
commit
05ba3f0e34
@ -325,12 +325,14 @@ class Keg
|
|||||||
private
|
private
|
||||||
|
|
||||||
def resolve_any_conflicts dst, mode
|
def resolve_any_conflicts dst, mode
|
||||||
|
return unless dst.symlink?
|
||||||
|
|
||||||
src = dst.resolved_path
|
src = dst.resolved_path
|
||||||
# src itself may be a symlink, so check lstat to ensure we are dealing with
|
# src itself may be a symlink, so check lstat to ensure we are dealing with
|
||||||
# a directory, and not a symlink pointing at a directory (which needs to be
|
# a directory, and not a symlink pointing at a directory (which needs to be
|
||||||
# treated as a file). In other words, we only want to resolve one symlink.
|
# treated as a file). In other words, we only want to resolve one symlink.
|
||||||
# If it isn't a directory, make_relative_symlink will raise an exception.
|
# If it isn't a directory, make_relative_symlink will raise an exception.
|
||||||
if dst.symlink? && src.lstat.directory?
|
if src.lstat.directory?
|
||||||
keg = Keg.for(src)
|
keg = Keg.for(src)
|
||||||
dst.unlink unless mode.dry_run
|
dst.unlink unless mode.dry_run
|
||||||
keg.link_dir(src, mode) { :mkpath }
|
keg.link_dir(src, mode) { :mkpath }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user