ruby-changes:74169
From: nagachika <ko1@a...>
Date: Fri, 21 Oct 2022 15:02:31 +0900 (JST)
Subject: [ruby-changes:74169] 3f3a5ec042 (ruby_3_1): merge revision(s) 6c1d7dab52b9bd26cbb624634b4acb86ba37aa7f:
https://git.ruby-lang.org/ruby.git/commit/?id=3f3a5ec042 From 3f3a5ec04222fd03945e3e6ef2e79ff7d07ce677 Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@r...> Date: Fri, 21 Oct 2022 14:56:31 +0900 Subject: merge revision(s) 6c1d7dab52b9bd26cbb624634b4acb86ba37aa7f: Fix conversion from absolute path to relative path --- tool/ln_sr.rb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) --- tool/ln_sr.rb | 25 +++++++++++++++---------- version.h | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tool/ln_sr.rb b/tool/ln_sr.rb index 307daa3202..6ab412edde 100644 --- a/tool/ln_sr.rb +++ b/tool/ln_sr.rb @@ -30,23 +30,28 @@ unless respond_to?(:ln_sr) https://github.com/ruby/ruby/blob/trunk/tool/ln_sr.rb#L30 def ln_sr(src, dest, target_directory: true, force: nil, noop: nil, verbose: nil) options = "#{force ? 'f' : ''}#{target_directory ? '' : 'T'}" dest = File.path(dest) - srcs = Array.try_convert(src) || [src] + srcs = Array(src) link = proc do |s, target_dir_p = true| s = File.path(s) + if target_dir_p + d = File.join(destdirs = dest, File.basename(s)) + else + destdirs = File.dirname(d = dest) + end + destdirs = fu_split_path(File.realpath(destdirs)) if fu_starting_path?(s) srcdirs = fu_split_path((File.realdirpath(s) rescue File.expand_path(s))) + base = fu_relative_components_from(srcdirs, destdirs) + s = File.join(*base) else srcdirs = fu_clean_components(*fu_split_path(s)) + base = fu_relative_components_from(fu_split_path(Dir.pwd), destdirs) + while srcdirs.first&. == ".." and base.last&.!=("..") and !fu_starting_path?(base.last) + srcdirs.shift + base.pop + end + s = File.join(*base, *srcdirs) end - destdirs = fu_split_path(File.realdirpath(dest)) - destdirs.pop unless target_dir_p - base = fu_relative_components_from(fu_split_path(Dir.pwd), destdirs) - while srcdirs.first&. == ".." and base.last and !fu_starting_path?(base.last) - srcdirs.shift - base.pop - end - s = File.join(*base, *srcdirs) - d = target_dir_p ? File.join(dest, File.basename(s)) : dest fu_output_message "ln -s#{options} #{s} #{d}" if verbose next if noop remove_file d, true if force diff --git a/version.h b/version.h index dceb8f6f7d..e54a2887bd 100644 --- a/version.h +++ b/version.h @@ -11,7 +11,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L11 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 3 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 137 +#define RUBY_PATCHLEVEL 138 #define RUBY_RELEASE_YEAR 2022 #define RUBY_RELEASE_MONTH 10 -- cgit v1.2.3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/