Fixes glob to work with 2.0.0
homesick list fails on ruby 2.0.0-rc2, I think because they fixed this bug: https://bugs.ruby-lang.org/issues/6977, changing the way recursive globs work. Test case: ```ruby require "homesick" require "pathname" repos = Homesick.new.send :repos_dir Dir.glob("#{repos}/**/*/.git") # => [] Dir.glob("#{repos}/**/*/.git", File::FNM_DOTMATCH) # => ["/home/eric/.homesick/repos/dotfiles/.git"] ``` This change, however, then broke 1.9.3, but removing the extra "/*" works on both 1.9 and 2.0.
This commit is contained in:
@@ -199,7 +199,7 @@ class Homesick < Thor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def all_castles
|
def all_castles
|
||||||
dirs = Pathname.glob("#{repos_dir}/**/*/.git")
|
dirs = Pathname.glob("#{repos_dir}/**/.git", File::FNM_DOTMATCH)
|
||||||
# reject paths that lie inside another castle, like git submodules
|
# reject paths that lie inside another castle, like git submodules
|
||||||
return dirs.reject do |dir|
|
return dirs.reject do |dir|
|
||||||
dirs.any? {|other| dir != other && dir.fnmatch(other.parent.join('*').to_s) }
|
dirs.any? {|other| dir != other && dir.fnmatch(other.parent.join('*').to_s) }
|
||||||
|
|||||||
Reference in New Issue
Block a user