Merge pull request #1795 from entireio/dry-push · Entire

Merge pull request #1795 from entireio/dry-push

cdd6a6b→main·

pjbgf·16h ago·3 files·+247 added/-67 removed

fix(remotehelper): skip receive-pack POST when send-pack emits no request

Changes

3

5 unmodified lines

6
7
8
9
10

5 unmodified lines

...
    ...
    ...
    ...
    ...
    ...
)

Minternal/remotehelper/githelper/consts_test.go+1

20 unmodified lines

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
151 unmodified lines
216
217
218
189
190
191
192
193
194
195
196
197
198
199
200
219
220
221
222
223
224
225
72 unmodified lines
298
299
300
279
280
301
302
303
304
305
283
306
307
308
309
310
311
312
313
314
290
291
292
293
294
315
316
317
318
319
320
321
298
322
323
324
325
2 unmodified lines
328
329
330
307
308
309
310
311
312
313
314
315
316
317
331
332
333
334
25 unmodified lines

360
361
362
349
363
364
365
366
367
368
369
356
357
370
371
372
373
359
374
375
376
377
378
379
29 unmodified lines

409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553

20 unmodified lines

...  
    ...  
    ...  
    ...  
    ...  
    ...  
    ...  
    ...

func wrappedSendPackRequest(oldSHA, newSHA, ref string) string {
    inner := pktLine(oldSHA+" "+newSHA+" "+ref+" report-status\n") + "0000"
    return fmt.Sprintf("%04x%s0000", len(inner)+4, inner)
}

func pushFakeTransport(oldSHA string) *fakeTransport {
    return &fakeTransport{
        infoRefsResp: func() (io.ReadCloser, error) {
            return stringRC(serviceAnnouncement(serviceReceivePack,
                oldSHA+" "+testRefMain+"\x00 report-status\n")), nil
        },
        serviceRPCResp: func(string, []byte) (io.ReadCloser, error) {
            return stringRC(""), nil
        },
    }
}

func TestInvariant_NoSpuriousAckOnTransportError(t *testing.T) {
    newSHA := strings.Repeat("b", 40)
    ref := testRefMain

ft := pushFakeTransport(oldSHA)

cmd := oldSHA + " " + newSHA + " " + ref + "\x00 report-status\n"
    var stdin bytes.Buffer
    // Further test code...
}

Minternal/remotehelper/githelper/invariants_test.go+195/-36

37 unmodified lines

...  
...  
...  
...  
...  
...  
...  
}