git-fastclone 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/git-fastclone/version.rb +1 -1
- data/lib/git-fastclone.rb +13 -6
- data/spec/git_fastclone_runner_spec.rb +19 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62066971856b4d6e34def960d0ec1214082d546f94a5ffe58b048eb5715511f0
|
4
|
+
data.tar.gz: d04c4ac8c866a011b3b6b279b3a9f2e719c6d284314086f91f4c73b189443f50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d807b912fd16fc82e3ce6ea2a3d568f37d1a946efdb750e7279baafa2a0c8206b2b6b298165321a0dd6306a975aacc873f0863c7ff18259b0b0126dd3c83f299
|
7
|
+
data.tar.gz: 0dde85446cad33944b3e1e61327b4656c435312fd6ef169b2b82fc4506d6e6bcedebdb0c808b5bdb52e7b0249472c2f033fa86647cadb6626dbcc953efaa6645
|
data/lib/git-fastclone.rb
CHANGED
@@ -162,14 +162,15 @@ module GitFastClone
|
|
162
162
|
options[:config] = config
|
163
163
|
end
|
164
164
|
|
165
|
-
opts.on('--lock-timeout N', 'Timeout in seconds to acquire a lock on any reference repo.
|
166
|
-
Default is 0 which waits indefinitely.') do |timeout_secs|
|
165
|
+
opts.on('--lock-timeout N', 'Timeout in seconds to acquire a lock on any reference repo.',
|
166
|
+
'Default is 0 which waits indefinitely.') do |timeout_secs|
|
167
167
|
self.flock_timeout_secs = timeout_secs.to_i
|
168
168
|
end
|
169
169
|
|
170
|
-
opts.on('--pre-clone-hook
|
171
|
-
'An optional
|
172
|
-
|
170
|
+
opts.on('--pre-clone-hook script_file',
|
171
|
+
'An optional file that should be invoked before cloning mirror repo',
|
172
|
+
'No-op when a file is missing') do |script_file|
|
173
|
+
options[:pre_clone_hook] = script_file
|
173
174
|
end
|
174
175
|
end.parse!
|
175
176
|
end
|
@@ -452,7 +453,13 @@ module GitFastClone
|
|
452
453
|
private def trigger_pre_clone_hook_if_needed(url, mirror, attempt_number)
|
453
454
|
return if Dir.exist?(mirror) || !options.include?(:pre_clone_hook)
|
454
455
|
|
455
|
-
|
456
|
+
hook_command = options[:pre_clone_hook]
|
457
|
+
unless File.exist?(File.expand_path(hook_command))
|
458
|
+
puts 'pre_clone_hook script is missing' if verbose
|
459
|
+
return
|
460
|
+
end
|
461
|
+
|
462
|
+
popen2e_wrapper(hook_command, url.to_s, mirror.to_s, attempt_number.to_s, quiet: !verbose)
|
456
463
|
end
|
457
464
|
end
|
458
465
|
end
|
@@ -146,11 +146,13 @@ describe GitFastClone::Runner do
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
context 'with pre-clone-hook
|
149
|
+
context 'with pre-clone-hook' do
|
150
150
|
let(:pre_clone_hook) { '/some/command' }
|
151
151
|
before(:each) do
|
152
152
|
subject.options[:pre_clone_hook] = pre_clone_hook
|
153
153
|
subject.reference_dir = placeholder_arg
|
154
|
+
allow(File).to receive(:exist?).and_call_original
|
155
|
+
allow(File).to receive(:exist?).with(pre_clone_hook).and_return(true)
|
154
156
|
allow(subject).to receive(:with_git_mirror).and_call_original
|
155
157
|
allow(subject).to receive(:with_reference_repo_lock) do |_url, &block|
|
156
158
|
block.call
|
@@ -192,6 +194,22 @@ describe GitFastClone::Runner do
|
|
192
194
|
|
193
195
|
subject.clone(placeholder_arg, nil, '.', 'config')
|
194
196
|
end
|
197
|
+
|
198
|
+
context 'non-existing script' do
|
199
|
+
before(:each) do
|
200
|
+
allow(File).to receive(:exist?).with(pre_clone_hook).and_return(false)
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'does not invoke hook command' do
|
204
|
+
allow(subject).to receive(:fail_on_error)
|
205
|
+
expect(subject).not_to receive(:popen2e_wrapper).with(
|
206
|
+
pre_clone_hook, 'PH', 'PH/PH', '0',
|
207
|
+
{ quiet: true }
|
208
|
+
)
|
209
|
+
|
210
|
+
subject.clone(placeholder_arg, nil, '.', 'config')
|
211
|
+
end
|
212
|
+
end
|
195
213
|
end
|
196
214
|
end
|
197
215
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-fastclone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Tauraso
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|