ruby-changes:54083
From: nobu <ko1@a...>
Date: Mon, 10 Dec 2018 10:58:30 +0900 (JST)
Subject: [ruby-changes:54083] nobu:r66304 (trunk): Detection order
nobu 2018-12-10 10:58:27 +0900 (Mon, 10 Dec 2018) New Revision: 66304 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66304 Log: Detection order * tool/vcs.rb (VCS.detect): detect each VCS while travarsing parent directories. Modified files: trunk/tool/vcs.rb Index: tool/vcs.rb =================================================================== --- tool/vcs.rb (revision 66303) +++ tool/vcs.rb (revision 66304) @@ -125,14 +125,13 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L125 end def self.detect(path) - @@dirs.each do |dir, klass, pred| - curr = path - loop { + curr = path + begin + @@dirs.each do |dir, klass, pred| return klass.new(curr) if pred ? pred[curr, dir] : File.directory?(File.join(curr, dir)) - prev, curr = curr, File.realpath(File.join(curr, '..')) - break if curr == prev # stop at the root directory - } - end + end + prev, curr = curr, File.realpath(File.join(curr, '..')) + end until curr == prev # stop at the root directory raise VCS::NotFoundError, "does not seem to be under a vcs: #{path}" end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/