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

ruby-changes:61369

From: Kazuhiro <ko1@a...>
Date: Mon, 25 May 2020 20:09:03 +0900 (JST)
Subject: [ruby-changes:61369] fcc8be0198 (master): Fix a failure in bundle version with version outputs the version with build metadata

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

From fcc8be0198a16cc5fa7d4827be0c781209b70f98 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Mon, 25 May 2020 20:06:49 +0900
Subject: Fix a failure in bundle version with version outputs the version with
 build metadata

```
  1) bundle version with version outputs the version with build metadata
     Failure/Error: expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/)

       expected "Bundler version 2.2.0.dev (2020-05-25 commit )" to match /\ABundler version 2\.2\.0\.dev \(\d{4}-\d{2}-\d{2} commit (?-mix:unknown|[a-fA-F0-9]{7,})\)\z/
       Diff:
       @@ -1,2 +1,2 @@
       -/\ABundler version 2\.2\.0\.dev \(\d{4}-\d{2}-\d{2} commit (?-mix:unknown|[a-fA-F0-9]{7,})\)\z/
       +"Bundler version 2.2.0.dev (2020-05-25 commit )"

       Commands:
       $ /home/user/snapshot-master/ruby -I/home/user/snapshot-master/spec/bundler -r/home/user/snapshot-master/spec/bundler/support/artifice/fail.rb -r/home/user/snapshot-master/spec/bundler/support/hax.rb /home/user/snapshot-master/tmp/1/gems/system/bin/bundle version
       Bundler version 2.2.0.dev (2020-05-25 commit )
       # $? => 0
```

diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 731a2d9..586603f 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -329,9 +329,10 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/helpers.rb#L329
 
         replace_version_file(version, dir: build_path) # rubocop:disable Style/HashSyntax
 
+        sys_exec("git rev-parse --short HEAD", :dir => source_root)
         build_metadata = {
           :built_at => loaded_gemspec.date.utc.strftime("%Y-%m-%d"),
-          :git_commit_sha => sys_exec("git rev-parse --short HEAD", :dir => source_root).strip,
+          :git_commit_sha => exitstatus.zero? ? out.strip : "unknown",
         }
 
         replace_build_metadata(build_metadata, dir: build_path) # rubocop:disable Style/HashSyntax
-- 
cgit v0.10.2


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

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