File tree Expand file tree Collapse file tree 4 files changed +37
-7
lines changed Expand file tree Collapse file tree 4 files changed +37
-7
lines changed Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- git-fastclone (1.2.3 )
4+ git-fastclone (1.2.4 )
55 colorize
66 terrapin (~> 0.6.0 )
77
Original file line number Diff line number Diff line change @@ -353,12 +353,13 @@ def with_git_mirror(url)
353353 yield dir
354354 rescue Terrapin ::ExitStatusError => e
355355 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 '
360361 ]
361- if e . to_s =~ /^STDERR:\n .+^fatal: #{ Regexp . union ( error_strings ) } /m
362+ if e . to_s =~ /^STDERR:\n .+^#{ Regexp . union ( error_strings ) } /m
362363 # To avoid corruption of the cache, if we failed to update or check out we remove
363364 # the cache directory entirely. This may cause the current clone to fail, but if the
364365 # underlying error from git is transient it will not affect future clones.
Original file line number Diff line number Diff line change 22
33# Version string for git-fastclone
44module GitFastCloneVersion
5- VERSION = '1.2.3 ' . freeze
5+ VERSION = '1.2.4 ' . freeze
66end
Original file line number Diff line number Diff line change 360360 expect ( yielded ) . to eq ( [ test_url_valid ] )
361361 end
362362 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
363392end
You can’t perform that action at this time.
0 commit comments