[前][次][番号順一覧][スレッド一覧]

ruby-changes:57629

From: Nobuyoshi <ko1@a...>
Date: Sat, 7 Sep 2019 11:59:35 +0900 (JST)
Subject: [ruby-changes:57629] 8b290448e3 (master): Assign to vcs in new_vcs block not to use rescue result

https://git.ruby-lang.org/ruby.git/commit/?id=8b290448e3

From 8b290448e3233e03b01288c179eb49bee63d1302 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 7 Sep 2019 11:56:23 +0900
Subject: Assign to vcs in new_vcs block not to use rescue result


diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb
index 2721d4a..db66be6 100755
--- a/tool/file2lastrev.rb
+++ b/tool/file2lastrev.rb
@@ -28,16 +28,17 @@ OptionParser.new {|opts| https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L28
   vcs_options = VCS.define_options(opts)
   new_vcs = proc do |path|
     begin
-      VCS.detect(path, vcs_options, opts.new)
+      vcs = VCS.detect(path, vcs_options, opts.new)
     rescue VCS::NotFoundError => e
       abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
       opts.remove
     end
+    nil
   end
   opts.new
   opts.on("--srcdir=PATH", "use PATH as source directory") do |path|
     abort "#{File.basename(Program)}: srcdir is already set" if vcs
-    vcs = new_vcs[path]
+    new_vcs[path]
   end
   opts.on("--changed", "changed rev") do
     self.output = :changed
@@ -62,7 +63,7 @@ OptionParser.new {|opts| https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L63
   if vcs
     vcs.set_options(vcs_options) # options after --srcdir
   else
-    vcs = new_vcs["."]
+    new_vcs["."]
   end
 }
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]