chef-cli 5.6.12 → 5.6.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 545307db6897b00d78f3b25421371e56f37fe7ef0f58698ad2cef26ff761ac1e
4
- data.tar.gz: f66467c288febf6b0f1a7ab85fac3a2a9881ca9976b571f29abd966372d91548
3
+ metadata.gz: e5ace4297d04cb8c5d06220ff10b33482402d8addc46666af48ec7d4d059216d
4
+ data.tar.gz: df9ff23ccab179fef3074f774955c5c14e338aa19428b38c375ad2a2378c48da
5
5
  SHA512:
6
- metadata.gz: 398f7c876022b50b7f6f35788c28e40cc722d1ebc66930d0ae93a1a8b276c731ae44b5c679a8b52b930d5bbc4442b2875dcb2bf8dd90ac0a260bc58db31ff540
7
- data.tar.gz: 18a0ff8e27a0d5aaabb95104091f134127f73db19c63fc1d4f3cb9b4ae6e475c09322b325fe624691f522058e4b78ea1cd2f1bea61324cf1e1a45a92636dd374
6
+ metadata.gz: 1f2ec47a77bba0c528f942824c138586690dff1a0069841df0981fd27d91b7e15c431c0065de241e22476fcccf78f76ece7c306180182ee3e1c864c970c0565c
7
+ data.tar.gz: 87b4e9babe9b75b4469a96eebea4467f2165d5eb0daf738b296647469e58dd6025117d38d53301774913e10808faf5ddcaa6c2a75136b810afe7ca12932132f6
@@ -23,10 +23,17 @@ module ChefCLI
23
23
 
24
24
  include Helpers
25
25
 
26
+ @@git_memo = {}
27
+
26
28
  attr_reader :cookbook_path
27
29
 
30
+ def self.uncache
31
+ @@git_memo = {}
32
+ end
33
+
28
34
  def initialize(cookbook_path)
29
35
  @cookbook_path = cookbook_path
36
+ @repo_path = nil
30
37
  @unborn_branch = nil
31
38
  @unborn_branch_ref = nil
32
39
  end
@@ -111,8 +118,24 @@ module ChefCLI
111
118
  end
112
119
 
113
120
  def git(subcommand, options = {})
114
- options = { cwd: cookbook_path }.merge(options)
115
- system_command("git #{subcommand}", options)
121
+ # memoize commands per-repo
122
+ repo_path = get_repo_path
123
+ memo_key = [repo_path, subcommand, options]
124
+ if @@git_memo.key?(memo_key)
125
+ rv = @@git_memo[memo_key]
126
+ else
127
+ options = { cwd: cookbook_path }.merge(options)
128
+ rv = system_command("git #{subcommand}", options)
129
+ @@git_memo[memo_key] = rv
130
+ end
131
+ rv
132
+ end
133
+
134
+ def get_repo_path
135
+ unless @repo_path
136
+ @repo_path = system_command("git rev-parse --show-toplevel", { cwd: cookbook_path }).stdout.strip
137
+ end
138
+ @repo_path
116
139
  end
117
140
 
118
141
  def detect_current_branch
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefCLI
19
- VERSION = "5.6.12".freeze
19
+ VERSION = "5.6.14".freeze
20
20
  end
@@ -25,7 +25,8 @@ describe ChefCLI::CookbookProfiler::Git do
25
25
 
26
26
  include ChefCLI::Helpers
27
27
 
28
- let(:git_profiler) do
28
+ let!(:git_profiler) do
29
+ ChefCLI::CookbookProfiler::Git.uncache
29
30
  ChefCLI::CookbookProfiler::Git.new(cookbook_path)
30
31
  end
31
32
 
@@ -50,6 +50,10 @@ describe ChefCLI::PolicyfileLock, "building a lockfile", :skip_on_windows do
50
50
  ChefCLI::Policyfile::StorageConfig.new( cache_path: cache_path, relative_paths_root: relative_paths_root )
51
51
  end
52
52
 
53
+ let!(:git_memo) do
54
+ ChefCLI::CookbookProfiler::Git.uncache
55
+ end
56
+
53
57
  context "when a cached cookbook omits the cache key" do
54
58
 
55
59
  let(:policyfile_lock) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.12
4
+ version: 5.6.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-22 00:00:00.000000000 Z
11
+ date: 2023-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-cli