1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix a error in a before(:suite) hook

https://github.com/ruby/actions/runs/703745101?check_suite_focus=true#step:16:27
```
An error occurred in a `before(:suite)` hook.
Failure/Error: contents = File.read(version_file)

Errno::ENOENT:
  No such file or directory @ rb_sysopen - /home/runner/work/actions/actions/snapshot-master/tmp/1/bundler-2.2.0.dev/lib/bundler/version.rb
```
This commit is contained in:
Kazuhiro NISHIYAMA 2020-05-25 20:00:50 +09:00
parent 45ffab365d
commit 67d2a715ca
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

View file

@ -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