[前][次][番号順一覧][スレッド一覧]

ruby-changes:61370

From: Kazuhiro <ko1@a...>
Date: Mon, 25 May 2020 20:09:03 +0900 (JST)
Subject: [ruby-changes:61370] 67d2a715ca (master): Fix a error in a `before(:suite)` hook

https://git.ruby-lang.org/ruby.git/commit/?id=67d2a715ca

From 67d2a715ca35090fbb3ab13df5b7348b1807dd47 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Mon, 25 May 2020 20:00:50 +0900
Subject: 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
```

diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index a810f07..4cf604a 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -235,6 +235,24 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/path.rb#L235
 
     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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]