summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-20 08:17:57 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-20 08:17:57 (GMT)
commit1bdc2d5150ea4bc51b868091a0cc8766c86043d5 (patch)
treed37af17485ad175fe9d4301e494f1abeb0079f59 /tool
parent131f699d98d9a43d9b91e5a5b27c764bbf4fedda (diff)
vcs.rb: git worktree
* tool/vcs.rb (VCS.detect, VCS::GIT): support working directory created by `git worktree`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r--tool/vcs.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index ca8aa6a..4d8936c 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -67,13 +67,15 @@ class VCS
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
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]