git-fastclone 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/git-fastclone.rb +7 -5
- data/lib/git-fastclone/version.rb +1 -1
- data/spec/git_fastclone_runner_spec.rb +57 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 163da1441ec081e545dba9b3fa54832c20307e7936f38cefb4df3e9ad9515887
|
4
|
+
data.tar.gz: 348f6449e1e7da1d8a66bfedf820832572852e03729788a37418dfef3df86848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd539f1544cbaa0d4d02b8657733b71b33683a994202e5e3f66e3a4ccd07a3ab34655c2d3f5764da1cca880722708688aba29333618a39c10c4873f3c67a9dcb
|
7
|
+
data.tar.gz: 5348e5a19d5d7bf863673952e1da137b1d65deac68ba8b76c6da4d190be53a244e776b208eecc248e2b018f88575e457137ad78670ea67cdfd5e97d65b35f3ab
|
data/lib/git-fastclone.rb
CHANGED
@@ -353,12 +353,14 @@ module GitFastClone
|
|
353
353
|
yield dir
|
354
354
|
rescue Terrapin::ExitStatusError => e
|
355
355
|
error_strings = [
|
356
|
-
'missing blob object',
|
357
|
-
'remote did not send all necessary objects',
|
358
|
-
/packed object [a-z0-9]+ \(stored in .*?\) is corrupt/,
|
359
|
-
/pack has \d+ unresolved deltas
|
356
|
+
'fatal: missing blob object',
|
357
|
+
'fatal: remote did not send all necessary objects',
|
358
|
+
/fatal: packed object [a-z0-9]+ \(stored in .*?\) is corrupt/,
|
359
|
+
/fatal: pack has \d+ unresolved deltas/,
|
360
|
+
'error: unable to read sha1 file of ',
|
361
|
+
'fatal: did not receive expected object'
|
360
362
|
]
|
361
|
-
if e.to_s =~ /^STDERR:\n
|
363
|
+
if e.to_s =~ /^STDERR:\n.+^#{Regexp.union(error_strings)}/m
|
362
364
|
# To avoid corruption of the cache, if we failed to update or check out we remove
|
363
365
|
# the cache directory entirely. This may cause the current clone to fail, but if the
|
364
366
|
# underlying error from git is transient it will not affect future clones.
|
@@ -360,4 +360,61 @@ describe GitFastClone::Runner do
|
|
360
360
|
expect(yielded).to eq([test_url_valid])
|
361
361
|
end
|
362
362
|
end
|
363
|
+
|
364
|
+
it 'should retry when the cache errors with unable to read sha1 file' do
|
365
|
+
allow(subject).to receive(:update_reference_repo) {}
|
366
|
+
expect(subject).to receive(:reference_repo_dir)
|
367
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
368
|
+
|
369
|
+
responses = [
|
370
|
+
lambda { |_url|
|
371
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
372
|
+
STDOUT:
|
373
|
+
|
374
|
+
STDERR:
|
375
|
+
|
376
|
+
error: unable to read sha1 file of sqiosbuild/lib/action/action.rb (6113b739af82d8b07731de8a58d6e233301f80ab)
|
377
|
+
fatal: unable to checkout working tree
|
378
|
+
warning: Clone succeeded, but checkout failed.
|
379
|
+
You can inspect what was checked out with 'git status'
|
380
|
+
and retry with 'git restore --source=HEAD :/'
|
381
|
+
ERROR
|
382
|
+
},
|
383
|
+
->(url) { url }
|
384
|
+
]
|
385
|
+
subject.with_git_mirror(test_url_valid) do
|
386
|
+
yielded << responses.shift.call(test_url_valid)
|
387
|
+
end
|
388
|
+
|
389
|
+
expect(responses).to be_empty
|
390
|
+
expect(yielded).to eq([test_url_valid])
|
391
|
+
end
|
392
|
+
|
393
|
+
it 'should retry when the cache errors with did not receive expected object' do
|
394
|
+
allow(subject).to receive(:update_reference_repo) {}
|
395
|
+
expect(subject).to receive(:reference_repo_dir)
|
396
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
397
|
+
|
398
|
+
responses = [
|
399
|
+
lambda { |_url|
|
400
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
401
|
+
STDOUT:
|
402
|
+
|
403
|
+
STDERR:
|
404
|
+
|
405
|
+
error: Could not read 6682dfe81f66656436e60883dd795e7ec6735153
|
406
|
+
error: Could not read 0cd3703c23fa44c0043d97fbc26356a23939f31b
|
407
|
+
fatal: did not receive expected object 3c64c9dd49c79bd09aa13d4b05ac18263ca29ccd
|
408
|
+
fatal: index-pack failed
|
409
|
+
ERROR
|
410
|
+
},
|
411
|
+
->(url) { url }
|
412
|
+
]
|
413
|
+
subject.with_git_mirror(test_url_valid) do
|
414
|
+
yielded << responses.shift.call(test_url_valid)
|
415
|
+
end
|
416
|
+
|
417
|
+
expect(responses).to be_empty
|
418
|
+
expect(yielded).to eq([test_url_valid])
|
419
|
+
end
|
363
420
|
end
|
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.2.
|
4
|
+
version: 1.2.5
|
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:
|
12
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -77,7 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.7.7
|
81
82
|
signing_key:
|
82
83
|
specification_version: 4
|
83
84
|
summary: git-clone --recursive on steroids!
|