git-fastclone 1.2.1 → 1.2.7
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.rb +10 -1
- data/lib/git-fastclone/version.rb +1 -1
- data/spec/git_fastclone_runner_spec.rb +167 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22f5537cbc1297198ea1aa106a305ef5ad9526dc24fc9a39048c6889e6d441b4
|
4
|
+
data.tar.gz: 0f1f38ba2756185c3c02b7a5ec3cf40c01e4498e743388f41991ca1d817793de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22634dabfc0c4d91682dc7db8d9e18e6cdc4a6d6db079a66c5e498ccc6ed70c8bcb7ccd24657b91e5142d0fe8be0f34169223d1d70cb1262ed3c6d88e3ec0e83
|
7
|
+
data.tar.gz: 8dd73fac0eb7eec9b8e8ead616a48549860722982b756b950ad020cd295da4dffeaf4b89b7dad3c88f2dc4b82119a40172a499441924bbcf2885e280313850eb
|
data/lib/git-fastclone.rb
CHANGED
@@ -352,7 +352,16 @@ module GitFastClone
|
|
352
352
|
begin
|
353
353
|
yield dir
|
354
354
|
rescue Terrapin::ExitStatusError => e
|
355
|
-
|
355
|
+
error_strings = [
|
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 delta/,
|
360
|
+
'error: unable to read sha1 file of ',
|
361
|
+
'fatal: did not receive expected object',
|
362
|
+
/^fatal: unable to read tree [a-z0-9]+\n^warning: Clone succeeded, but checkout failed/
|
363
|
+
]
|
364
|
+
if e.to_s =~ /^STDERR:\n.+^#{Regexp.union(error_strings)}/m
|
356
365
|
# To avoid corruption of the cache, if we failed to update or check out we remove
|
357
366
|
# the cache directory entirely. This may cause the current clone to fail, but if the
|
358
367
|
# underlying error from git is transient it will not affect future clones.
|
@@ -305,5 +305,172 @@ describe GitFastClone::Runner do
|
|
305
305
|
expect(responses).to be_empty
|
306
306
|
expect(yielded).to eq([test_url_valid])
|
307
307
|
end
|
308
|
+
|
309
|
+
it 'should retry when the clone succeeds but checkout fails with corrupt packed object' do
|
310
|
+
allow(subject).to receive(:update_reference_repo) {}
|
311
|
+
expect(subject).to receive(:reference_repo_dir)
|
312
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
313
|
+
|
314
|
+
responses = [
|
315
|
+
lambda { |_url|
|
316
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
317
|
+
STDOUT:
|
318
|
+
|
319
|
+
STDERR:
|
320
|
+
|
321
|
+
fatal: packed object 7c4d79704f8adf701f38a7bfb3e33ec5342542f1 (stored in /private/var/tmp/git-fastclone/reference/some-repo.git/objects/pack/pack-d37d7ed3e88d6e5f0ac141a7b0a2b32baf6e21a0.pack) is corrupt
|
322
|
+
warning: Clone succeeded, but checkout failed.
|
323
|
+
You can inspect what was checked out with 'git status' and retry with 'git restore --source=HEAD :/'
|
324
|
+
ERROR
|
325
|
+
},
|
326
|
+
->(url) { url }
|
327
|
+
]
|
328
|
+
subject.with_git_mirror(test_url_valid) do
|
329
|
+
yielded << responses.shift.call(test_url_valid)
|
330
|
+
end
|
331
|
+
|
332
|
+
expect(responses).to be_empty
|
333
|
+
expect(yielded).to eq([test_url_valid])
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'should retry when the clone succeeds but checkout fails with unable to read tree' do
|
337
|
+
allow(subject).to receive(:update_reference_repo) {}
|
338
|
+
expect(subject).to receive(:reference_repo_dir)
|
339
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
340
|
+
|
341
|
+
responses = [
|
342
|
+
lambda { |_url|
|
343
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
344
|
+
STDOUT:
|
345
|
+
|
346
|
+
STDERR:
|
347
|
+
|
348
|
+
error: Could not read 92cf57b8f07df010ab5f607b109c325e30e46235
|
349
|
+
fatal: unable to read tree 0c32c0521d3b0bfb4e74e4a39b97a84d1a3bb9a1
|
350
|
+
warning: Clone succeeded, but checkout failed.
|
351
|
+
You can inspect what was checked out with 'git status'
|
352
|
+
and retry with 'git restore --source=HEAD :/'
|
353
|
+
ERROR
|
354
|
+
},
|
355
|
+
->(url) { url }
|
356
|
+
]
|
357
|
+
subject.with_git_mirror(test_url_valid) do
|
358
|
+
yielded << responses.shift.call(test_url_valid)
|
359
|
+
end
|
360
|
+
|
361
|
+
expect(responses).to be_empty
|
362
|
+
expect(yielded).to eq([test_url_valid])
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'should retry when one delta is missing' do
|
366
|
+
allow(subject).to receive(:update_reference_repo) {}
|
367
|
+
expect(subject).to receive(:reference_repo_dir)
|
368
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
369
|
+
|
370
|
+
responses = [
|
371
|
+
lambda { |_url|
|
372
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
373
|
+
STDOUT:
|
374
|
+
|
375
|
+
STDERR:
|
376
|
+
|
377
|
+
error: Could not read f7fad86d06fee0678f9af7203b6031feabb40c3e
|
378
|
+
fatal: pack has 1 unresolved delta
|
379
|
+
fatal: index-pack failed
|
380
|
+
ERROR
|
381
|
+
},
|
382
|
+
->(url) { url }
|
383
|
+
]
|
384
|
+
subject.with_git_mirror(test_url_valid) do
|
385
|
+
yielded << responses.shift.call(test_url_valid)
|
386
|
+
end
|
387
|
+
|
388
|
+
expect(responses).to be_empty
|
389
|
+
expect(yielded).to eq([test_url_valid])
|
390
|
+
end
|
391
|
+
|
392
|
+
it 'should retry when deltas are missing' do
|
393
|
+
allow(subject).to receive(:update_reference_repo) {}
|
394
|
+
expect(subject).to receive(:reference_repo_dir)
|
395
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
396
|
+
|
397
|
+
responses = [
|
398
|
+
lambda { |_url|
|
399
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
400
|
+
STDOUT:
|
401
|
+
|
402
|
+
STDERR:
|
403
|
+
|
404
|
+
error: Could not read f7fad86d06fee0678f9af7203b6031feabb40c3e
|
405
|
+
fatal: pack has 138063 unresolved deltas
|
406
|
+
fatal: index-pack failed
|
407
|
+
ERROR
|
408
|
+
},
|
409
|
+
->(url) { url }
|
410
|
+
]
|
411
|
+
subject.with_git_mirror(test_url_valid) do
|
412
|
+
yielded << responses.shift.call(test_url_valid)
|
413
|
+
end
|
414
|
+
|
415
|
+
expect(responses).to be_empty
|
416
|
+
expect(yielded).to eq([test_url_valid])
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
it 'should retry when the cache errors with unable to read sha1 file' do
|
421
|
+
allow(subject).to receive(:update_reference_repo) {}
|
422
|
+
expect(subject).to receive(:reference_repo_dir)
|
423
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
424
|
+
|
425
|
+
responses = [
|
426
|
+
lambda { |_url|
|
427
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
428
|
+
STDOUT:
|
429
|
+
|
430
|
+
STDERR:
|
431
|
+
|
432
|
+
error: unable to read sha1 file of sqiosbuild/lib/action/action.rb (6113b739af82d8b07731de8a58d6e233301f80ab)
|
433
|
+
fatal: unable to checkout working tree
|
434
|
+
warning: Clone succeeded, but checkout failed.
|
435
|
+
You can inspect what was checked out with 'git status'
|
436
|
+
and retry with 'git restore --source=HEAD :/'
|
437
|
+
ERROR
|
438
|
+
},
|
439
|
+
->(url) { url }
|
440
|
+
]
|
441
|
+
subject.with_git_mirror(test_url_valid) do
|
442
|
+
yielded << responses.shift.call(test_url_valid)
|
443
|
+
end
|
444
|
+
|
445
|
+
expect(responses).to be_empty
|
446
|
+
expect(yielded).to eq([test_url_valid])
|
447
|
+
end
|
448
|
+
|
449
|
+
it 'should retry when the cache errors with did not receive expected object' do
|
450
|
+
allow(subject).to receive(:update_reference_repo) {}
|
451
|
+
expect(subject).to receive(:reference_repo_dir)
|
452
|
+
expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile)
|
453
|
+
|
454
|
+
responses = [
|
455
|
+
lambda { |_url|
|
456
|
+
raise Terrapin::ExitStatusError, <<-ERROR.gsub(/^ {12}/, '')
|
457
|
+
STDOUT:
|
458
|
+
|
459
|
+
STDERR:
|
460
|
+
|
461
|
+
error: Could not read 6682dfe81f66656436e60883dd795e7ec6735153
|
462
|
+
error: Could not read 0cd3703c23fa44c0043d97fbc26356a23939f31b
|
463
|
+
fatal: did not receive expected object 3c64c9dd49c79bd09aa13d4b05ac18263ca29ccd
|
464
|
+
fatal: index-pack failed
|
465
|
+
ERROR
|
466
|
+
},
|
467
|
+
->(url) { url }
|
468
|
+
]
|
469
|
+
subject.with_git_mirror(test_url_valid) do
|
470
|
+
yielded << responses.shift.call(test_url_valid)
|
471
|
+
end
|
472
|
+
|
473
|
+
expect(responses).to be_empty
|
474
|
+
expect(yielded).to eq([test_url_valid])
|
308
475
|
end
|
309
476
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Tauraso
|
8
8
|
- James Chang
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -62,7 +62,7 @@ homepage: http://square.github.io/git-fastclone/
|
|
62
62
|
licenses:
|
63
63
|
- Apache
|
64
64
|
metadata: {}
|
65
|
-
post_install_message:
|
65
|
+
post_install_message:
|
66
66
|
rdoc_options: []
|
67
67
|
require_paths:
|
68
68
|
- lib
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubygems_version: 3.0.1
|
81
|
-
signing_key:
|
81
|
+
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: git-clone --recursive on steroids!
|
84
84
|
test_files:
|