summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
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 ca8aa6a391..4d8936cb54 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]