aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/support/path.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/support/path.rb')
-rw-r--r--spec/bundler/support/path.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index a810f0735f..4cf604a267 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -235,6 +235,24 @@ module Spec
def git_ls_files(glob)
sys_exec("git ls-files -z -- #{glob}", :dir => source_root).split("\x0")
+ ensure
+ if err == "fatal: not a git repository (or any of the parent directories): .git"
+ @command_executions.pop # Remove failed "git ls-files"
+ Dir.chdir(source_root) do
+ files = []
+ Dir.glob(glob.shellsplit) do |path|
+ if File.directory?(path)
+ Dir.glob("#{path}/**/{*,.*}") do |sub_path|
+ next if File.directory?(sub_path)
+ files << sub_path
+ end
+ else
+ files << path
+ end
+ end
+ return files.uniq
+ end
+ end
end
def tracked_files_glob