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

ruby-changes:41527

From: nobu <ko1@a...>
Date: Wed, 20 Jan 2016 17:17:17 +0900 (JST)
Subject: [ruby-changes:41527] nobu:r53601 (trunk): vcs.rb: git worktree

nobu	2016-01-20 17:17:57 +0900 (Wed, 20 Jan 2016)

  New Revision: 53601

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53601

  Log:
    vcs.rb: git worktree
    
    * tool/vcs.rb (VCS.detect, VCS::GIT): support working directory
      created by `git worktree`.

  Modified files:
    trunk/tool/vcs.rb
Index: tool/vcs.rb
===================================================================
--- tool/vcs.rb	(revision 53600)
+++ tool/vcs.rb	(revision 53601)
@@ -67,13 +67,15 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L67
   class NotFoundError < RuntimeError; end
 
   @@dirs = []
-  def self.register(dir)
-    @@dirs << [dir, self]
+  def self.register(dir, &pred)
+    @@dirs << [dir, self, pred]
   end
 
   def self.detect(path)
-    @@dirs.each do |dir, klass|
-      return klass.new(path) if File.directory?(File.join(path, dir))
+    @@dirs.each do |dir, klass, pred|
+      if pred ? pred[path, dir] : File.directory?(File.join(path, dir))
+        return klass.new(path)
+      end
       prev = path
       loop {
         curr = File.realpath(File.join(prev, '..'))
@@ -282,7 +284,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L284
   end
 
   class GIT < self
-    register(".git")
+    register(".git") {|path, dir| File.exist?(File.join(path, dir))}
 
     def self.get_revisions(path, srcdir = nil)
       gitcmd = %W[git]

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

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