summaryrefslogtreecommitdiff
path: root/tool/ln_sr.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-20 12:54:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-20 12:54:08 +0900
commit9de11fe796e8caca2d87650278028eb95c1e09a0 (patch)
tree475648bca650a0829c1f19fc82b8a44afb83a20e /tool/ln_sr.rb
parent55e540f7ab6adb3ea0de16912dfde8e0bf94cc6e (diff)
downloadruby-9de11fe796e8caca2d87650278028eb95c1e09a0.tar.gz
Quiet if the target is already linked the same source
Diffstat (limited to 'tool/ln_sr.rb')
-rwxr-xr-xtool/ln_sr.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/tool/ln_sr.rb b/tool/ln_sr.rb
index 81fd803355..2aa8391e17 100755
--- a/tool/ln_sr.rb
+++ b/tool/ln_sr.rb
@@ -3,6 +3,7 @@
target_directory = true
noop = false
force = false
+quiet = false
until ARGV.empty?
case ARGV[0]
@@ -12,6 +13,8 @@ until ARGV.empty?
force = true
when '-T'
target_directory = false
+ when '-q'
+ quiet = true
else
break
end
@@ -114,6 +117,9 @@ unless respond_to?(:ln_sr)
end
if File.respond_to?(:symlink)
+ if quiet and File.identical?(src, dest)
+ exit
+ end
begin
ln_sr(src, dest, verbose: true, target_directory: target_directory, force: force, noop: noop)
rescue NotImplementedError, Errno::EPERM, Errno::EACCES