|
306 | 306 | expect(yielded).to eq([test_url_valid]) |
307 | 307 | end |
308 | 308 |
|
309 | | - it 'should retry when the clone succeeds but checkout fails' do |
| 309 | + it 'should retry when the clone succeeds but checkout fails with corrupt packed object' do |
310 | 310 | allow(subject).to receive(:update_reference_repo) {} |
311 | 311 | expect(subject).to receive(:reference_repo_dir) |
312 | 312 | expect(subject).to receive(:reference_repo_lock_file).and_return(lockfile) |
|
333 | 333 | expect(yielded).to eq([test_url_valid]) |
334 | 334 | end |
335 | 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 | + |
336 | 365 | it 'should retry when one delta is missing' do |
337 | 366 | allow(subject).to receive(:update_reference_repo) {} |
338 | 367 | expect(subject).to receive(:reference_repo_dir) |
|
0 commit comments