aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2013-07-10 08:50:53 -0700
committerAdam Vandenberg2013-07-10 08:54:18 -0700
commite6d3f6580b707e5c32bcba983e770c7f5e75e817 (patch)
tree088a3d03300a8948bf88798b87a14eaef72bbb5a /Library
parente096fba9d85d265ecd754bb2fa8c994d5047e124 (diff)
downloadhomebrew-e6d3f6580b707e5c32bcba983e770c7f5e75e817.tar.bz2
Show symlink target if linking fails
Closes #21060.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg.rb21
1 files changed, 15 insertions, 6 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 001b54e4f..207c0467f 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -208,18 +208,27 @@ class Keg < Pathname
def make_relative_symlink dst, src, mode=OpenStruct.new
if dst.exist? and dst.realpath == src.realpath
puts "Skipping; already exists: #{dst}" if ARGV.verbose?
+ return
+ end
+
# cf. git-clean -n: list files to delete, don't really link or delete
- elsif mode.dry_run and mode.overwrite
- puts dst if dst.exist? or dst.symlink?
+ if mode.dry_run and mode.overwrite
+ if dst.symlink?
+ puts "#{dst} -> #{dst.resolved_path}"
+ elsif dst.exist?
+ puts dst
+ end
return
+ end
+
# list all link targets
- elsif mode.dry_run
+ if mode.dry_run
puts dst
return
- else
- dst.delete if mode.overwrite && (dst.exist? or dst.symlink?)
- dst.make_relative_symlink src
end
+
+ dst.delete if mode.overwrite && (dst.exist? or dst.symlink?)
+ dst.make_relative_symlink src
end
# symlinks the contents of self+foo recursively into #{HOMEBREW_PREFIX}/foo