Skip to content

Commit fea5d15

Browse files
committed
(bug) Correctly get config for GClone spec searcher
This fixes a bug that was incorrectly fetching config from the `GitConfiguration` class in the `GClone` spec searcher.
1 parent d9f631e commit fea5d15

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lib/puppetfile-resolver/spec_searchers/git/gclone.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ def self.metadata(puppetfile_module, resolver_ui, config)
4747
def self.clone_and_read_file(url, ref, file, config)
4848
clone_cmd = ['git', 'clone', '--bare', '--depth=1', '--single-branch']
4949
err_msg = ''
50-
if config.git.proxy
51-
err_msg += " with proxy #{config.git.proxy}: "
52-
proxy = "--config \"http.proxy=#{config.git.proxy}\" --config \"https.proxy=#{config.proxy}\""
50+
if config.proxy
51+
err_msg += " with proxy #{config.proxy}: "
52+
proxy = "--config \"http.proxy=#{config.proxy}\" --config \"https.proxy=#{config.proxy}\""
5353
clone_cmd.push(proxy)
5454
end
5555

56-
Dir.mktmpdir(nil, config.git.clone_dir) do |dir|
56+
Dir.mktmpdir(nil, config.clone_dir) do |dir|
5757
clone_cmd.push("--branch=#{ref}") if ref != 'HEAD'
5858
clone_cmd.push(url, dir)
5959
out, err_out, process = ::PuppetfileResolver::Util.run_command(clone_cmd)

spec/unit/puppetfile-resolver/spec_searchers/git/gclone_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
describe PuppetfileResolver::SpecSearchers::Git::GClone do
88
PuppetfileModule = Struct.new(:remote, :ref, :branch, :commit, :tag, keyword_init: true)
9-
config = PuppetfileResolver::SpecSearchers::Configuration.new
10-
config.local.puppet_module_paths = [File.join(FIXTURES_DIR, 'modulepath')]
9+
config = PuppetfileResolver::SpecSearchers::GitConfiguration.new
1110

1211
let(:url) do
1312
'https://github.com/puppetlabs/puppetlabs-powershell'
@@ -39,7 +38,7 @@
3938

4039
context 'invalid url' do
4140
let(:url) do
42-
'https://github.com/puppetlabs/puppetlabs-powershellbad'
41+
'https://user:password@github.com/puppetlabs/puppetlabs-powershellbad'
4342
end
4443

4544
it 'throws exception' do

0 commit comments

Comments
 (0)