summaryrefslogtreecommitdiff
path: root/tests/libgit2/patch/patch_common.h
blob: 7e2cb6a589fa22f6f6f8bd99f0817433d3e8f4da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
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
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
/* The original file contents */

#define FILE_ORIGINAL \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

/* A change in the middle of the file (and the resultant patch) */

#define FILE_CHANGE_MIDDLE \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(THIS line is changed!)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_CHANGE_MIDDLE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -3,7 +3,7 @@ this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -6 +6 @@ yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n"

/* A change of the first line (and the resultant patch) */

#define FILE_CHANGE_FIRSTLINE \
	"hey, change in head!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_CHANGE_FIRSTLINE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..c81df1d 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,4 +1,4 @@\n" \
	"-hey!\n" \
	"+hey, change in head!\n" \
	" this is some context!\n" \
	" around some lines\n" \
	" that will change\n"

/* A change of the last line (and the resultant patch) */

#define FILE_CHANGE_LASTLINE \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"change to the last line.\n"

#define PATCH_ORIGINAL_TO_CHANGE_LASTLINE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..f70db1c 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -6,4 +6,4 @@ yes it is!\n" \
	" (this line is changed)\n" \
	" and this\n" \
	" is additional context\n" \
	"-below it!\n" \
	"+change to the last line.\n"

/* A change of the middle where we remove many lines */

#define FILE_CHANGE_MIDDLE_SHRINK \
	"hey!\n" \
	"i've changed a lot, but left the line\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_SHRINK \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..629cd35 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,9 +1,3 @@\n" \
	" hey!\n" \
	"-this is some context!\n" \
	"-around some lines\n" \
	"-that will change\n" \
	"-yes it is!\n" \
	"-(this line is changed)\n" \
	"-and this\n" \
	"-is additional context\n" \
	"+i've changed a lot, but left the line\n" \
	" below it!\n"

#define PATCH_ORIGINAL_TO_MIDDLE_SHRINK_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..629cd35 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -2,7 +2 @@ hey!\n" \
	"-this is some context!\n" \
	"-around some lines\n" \
	"-that will change\n" \
	"-yes it is!\n" \
	"-(this line is changed)\n" \
	"-and this\n" \
	"-is additional context\n" \
	"+i've changed a lot, but left the line\n"

/* A change to the middle where we grow many lines */

#define FILE_CHANGE_MIDDLE_GROW \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"this line is changed\n" \
	"and this line is added\n" \
	"so is this\n" \
	"(this too)\n" \
	"whee...\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_GROW \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..207ebca 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -3,7 +3,11 @@ this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+this line is changed\n" \
	"+and this line is added\n" \
	"+so is this\n" \
	"+(this too)\n" \
	"+whee...\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"


#define PATCH_ORIGINAL_TO_MIDDLE_GROW_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..207ebca 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -6 +6,5 @@ yes it is!\n" \
	"-(this line is changed)\n" \
	"+this line is changed\n" \
	"+and this line is added\n" \
	"+so is this\n" \
	"+(this too)\n" \
	"+whee...\n"

/* An insertion at the beginning of the file (and the resultant patch) */

#define FILE_PREPEND \
	"insert at front\n" \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_PREPEND \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..0f39b9a 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,3 +1,4 @@\n" \
	"+insert at front\n" \
	" hey!\n" \
	" this is some context!\n" \
	" around some lines\n"

#define PATCH_ORIGINAL_TO_PREPEND_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..0f39b9a 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -0,0 +1 @@\n" \
	"+insert at front\n"

/* An insertion at the beginning of the file and change in the middle */

#define FILE_PREPEND_AND_CHANGE \
	"insert at front\n" \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(THIS line is changed!)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_PREPEND_AND_CHANGE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..f73c8bb 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,9 +1,10 @@\n" \
	"+insert at front\n" \
	" hey!\n" \
	" this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define PATCH_ORIGINAL_TO_PREPEND_AND_CHANGE_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..f73c8bb 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -0,0 +1 @@\n" \
	"+insert at front\n" \
	"@@ -6 +7 @@ yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n"

/* A change in the middle and a deletion of the newline at the end of the file */

#define FILE_CHANGE_MIDDLE_AND_LASTLINE \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(THIS line is changed!)\n" \
	"and this\n" \
	"is additional context\n" \
	"BELOW it! - (THIS line is changed!)"

#define PATCH_ORIGINAL_TO_CHANGE_MIDDLE_AND_LASTLINE_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..e05d36c 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -6 +6 @@ yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	"@@ -9 +9 @@ is additional context\n" \
	"-below it!\n" \
	"+BELOW it! - (THIS line is changed!)\n" \
	"\\ No newline at end of file\n"

/* A deletion at the beginning of the file and a change in the middle */

#define FILE_DELETE_AND_CHANGE \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(THIS line is changed!)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_DELETE_AND_CHANGE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..1e2dfa6 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,9 +1,8 @@\n" \
	"-hey!\n" \
	" this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define PATCH_ORIGINAL_TO_DELETE_AND_CHANGE_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..1e2dfa6 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1 +0,0 @@\n" \
	"-hey!\n" \
	"@@ -6 +5 @@ yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n"

/* A deletion at the beginning of the file */

#define FILE_DELETE_FIRSTLINE \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n"

#define PATCH_ORIGINAL_TO_DELETE_FIRSTLINE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..f31fa13 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,4 +1,3 @@\n" \
	"-hey!\n" \
	" this is some context!\n" \
	" around some lines\n" \
	" that will change\n"

/* An insertion at the end of the file (and the resultant patch) */

#define FILE_APPEND \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n" \
	"insert at end\n"

#define PATCH_ORIGINAL_TO_APPEND \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..72788bb 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -7,3 +7,4 @@ yes it is!\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n" \
	"+insert at end\n"

#define PATCH_ORIGINAL_TO_APPEND_NOCONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..72788bb 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -9,0 +10 @@ below it!\n" \
	"+insert at end\n"

#define PATCH_DELETED_FILE_2_HUNKS \
	"diff --git a/a b/a\n" \
	"index 7f129fd..af431f2 100644\n" \
	"--- a/a\n" \
	"+++ b/a\n" \
	"@@ -1 +1 @@\n" \
	"-a contents 2\n" \
	"+a contents\n" \
	"diff --git a/c/d b/c/d\n" \
	"deleted file mode 100644\n" \
	"index 297efb8..0000000\n" \
	"--- a/c/d\n" \
	"+++ /dev/null\n" \
	"@@ -1 +0,0 @@\n" \
	"-c/d contents\n"

#define PATCH_DELETED_FILE_2_HUNKS_SHUFFLED \
	"diff --git a/c/d b/c/d\n" \
	"deleted file mode 100644\n" \
	"index 297efb8..0000000\n" \
	"--- a/c/d\n" \
	"+++ /dev/null\n" \
	"@@ -1 +0,0 @@\n" \
	"-c/d contents\n" \
	"diff --git a/a b/a\n" \
	"index 7f129fd..af431f2 100644\n" \
	"--- a/a\n" \
	"+++ b/a\n" \
	"@@ -1 +1 @@\n" \
	"-a contents 2\n" \
	"+a contents\n"

#define PATCH_SIMPLE_COMMIT \
	"commit 15e119375018fba121cf58e02a9f17fe22df0df8\n" \
	"Author: Edward Thomson <ethomson@edwardthomson.com>\n" \
	"Date:   Wed Jun 14 13:31:20 2017 +0200\n" \
	"\n" \
	"    CHANGELOG: document git_filter_init and GIT_FILTER_INIT\n" \
	"\n" \
	"diff --git a/CHANGELOG.md b/CHANGELOG.md\n" \
	"index 1b9e0c90a..24ecba426 100644\n" \
	"--- a/CHANGELOG.md\n" \
	"+++ b/CHANGELOG.md\n" \
	"@@ -96,6 +96,9 @@ v0.26\n" \
	" * `git_transport_smart_proxy_options()' enables you to get the proxy options for\n" \
	"   smart transports.\n" \
	"\n" \
	"+* The `GIT_FILTER_INIT` macro and the `git_filter_init` function are provided\n" \
	"+  to initialize a `git_filter` structure.\n" \
	"+\n" \
	" ### Breaking API changes\n" \
	"\n" \
	" * `clone_checkout_strategy` has been removed from\n"

#define PATCH_MULTIPLE_HUNKS \
	"diff --git a/x b/x\n" \
	"index 0719398..fa0350c 100644\n" \
	"--- a/x\n" \
	"+++ b/x\n" \
	"@@ -1,5 +1,4 @@\n" \
	" 1\n" \
	"-2\n" \
	" 3\n" \
	" 4\n" \
	" 5\n" \
	"@@ -7,3 +6,4 @@\n" \
	" 7\n" \
	" 8\n" \
	" 9\n" \
	"+10\n"

#define PATCH_MULTIPLE_FILES \
	"diff --git a/x b/x\n" \
	"index 8a1218a..7059ba5 100644\n" \
	"--- a/x\n" \
	"+++ b/x\n" \
	"@@ -1,5 +1,4 @@\n" \
	" 1\n" \
	" 2\n" \
	"-3\n" \
	" 4\n" \
	" 5\n" \
	"diff --git a/y b/y\n" \
	"index e006065..9405325 100644\n" \
	"--- a/y\n" \
	"+++ b/y\n" \
	"@@ -1,4 +1,5 @@\n" \
	" a\n" \
	" b\n" \
	"+c\n" \
	" d\n" \
	" e\n"

#define FILE_PREPEND_AND_APPEND \
	"first and\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"last lines\n"

#define PATCH_ORIGINAL_TO_PREPEND_AND_APPEND \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..f282430 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,4 +1,4 @@\n" \
	"-hey!\n" \
	"+first and\n" \
	" this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	"@@ -6,4 +6,4 @@ yes it is!\n" \
	" (this line is changed)\n" \
	" and this\n" \
	" is additional context\n" \
	"-below it!\n" \
	"+last lines\n"

#define PATCH_ORIGINAL_TO_EMPTY_FILE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..e69de29 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,9 +0,0 @@\n" \
	"-hey!\n" \
	"-this is some context!\n" \
	"-around some lines\n" \
	"-that will change\n" \
	"-yes it is!\n" \
	"-(this line is changed)\n" \
	"-and this\n" \
	"-is additional context\n" \
	"-below it!\n"

#define PATCH_EMPTY_FILE_TO_ORIGINAL \
	"diff --git a/file.txt b/file.txt\n" \
	"index e69de29..9432026 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -0,0 +1,9 @@\n" \
	"+hey!\n" \
	"+this is some context!\n" \
	"+around some lines\n" \
	"+that will change\n" \
	"+yes it is!\n" \
	"+(this line is changed)\n" \
	"+and this\n" \
	"+is additional context\n" \
	"+below it!\n"

#define PATCH_ADD_ORIGINAL \
	"diff --git a/file.txt b/file.txt\n" \
	"new file mode 100644\n" \
	"index 0000000..9432026\n" \
	"--- /dev/null\n" \
	"+++ b/file.txt\n" \
	"@@ -0,0 +1,9 @@\n" \
	"+hey!\n" \
	"+this is some context!\n" \
	"+around some lines\n" \
	"+that will change\n" \
	"+yes it is!\n" \
	"+(this line is changed)\n" \
	"+and this\n" \
	"+is additional context\n" \
	"+below it!\n"

#define PATCH_DELETE_ORIGINAL \
	"diff --git a/file.txt b/file.txt\n" \
	"deleted file mode 100644\n" \
	"index 9432026..0000000\n" \
	"--- a/file.txt\n" \
	"+++ /dev/null\n" \
	"@@ -1,9 +0,0 @@\n" \
	"-hey!\n" \
	"-this is some context!\n" \
	"-around some lines\n" \
	"-that will change\n" \
	"-yes it is!\n" \
	"-(this line is changed)\n" \
	"-and this\n" \
	"-is additional context\n" \
	"-below it!\n"

#define PATCH_RENAME_EXACT \
	"diff --git a/file.txt b/newfile.txt\n" \
	"similarity index 100%\n" \
	"rename from file.txt\n" \
	"rename to newfile.txt\n"

#define PATCH_RENAME_EXACT_WITH_MODE \
	"diff --git a/RENAMED.md b/README.md\n" \
	"old mode 100644\n" \
	"new mode 100755\n" \
	"similarity index 100%\n" \
	"rename from RENAMED.md\n" \
	"rename to README.md\n"

#define PATCH_RENAME_SIMILAR \
	"diff --git a/file.txt b/newfile.txt\n" \
	"similarity index 77%\n" \
	"rename from file.txt\n" \
	"rename to newfile.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/newfile.txt\n" \
	"@@ -3,7 +3,7 @@ this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define PATCH_RENAME_EXACT_QUOTEDNAME \
	"diff --git a/file.txt \"b/foo\\\"bar.txt\"\n" \
	"similarity index 100%\n" \
	"rename from file.txt\n" \
	"rename to \"foo\\\"bar.txt\"\n"

#define PATCH_RENAME_SIMILAR_QUOTEDNAME \
	"diff --git a/file.txt \"b/foo\\\"bar.txt\"\n" \
	"similarity index 77%\n" \
	"rename from file.txt\n" \
	"rename to \"foo\\\"bar.txt\"\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ \"b/foo\\\"bar.txt\"\n" \
	"@@ -3,7 +3,7 @@ this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define PATCH_MODECHANGE_UNCHANGED \
	"diff --git a/file.txt b/file.txt\n" \
	"old mode 100644\n" \
	"new mode 100755\n"

#define PATCH_MODECHANGE_MODIFIED \
	"diff --git a/file.txt b/file.txt\n" \
	"old mode 100644\n" \
	"new mode 100755\n" \
	"index 9432026..cd8fd12\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -3,7 +3,7 @@ this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define PATCH_NOISY \
	"This is some\nleading noise\n@@ - that\nlooks like a hunk header\n" \
	"but actually isn't and should parse ok\n" \
	PATCH_ORIGINAL_TO_CHANGE_MIDDLE \
	"plus some trailing garbage for good measure\n"

#define PATCH_NOISY_NOCONTEXT \
	"This is some\nleading noise\n@@ - that\nlooks like a hunk header\n" \
	"but actually isn't and should parse ok\n" \
	PATCH_ORIGINAL_TO_CHANGE_MIDDLE_NOCONTEXT \
	"plus some trailing garbage for good measure\n"

#define PATCH_TRUNCATED_1 \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -3,7 +3,7 @@ this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n"

#define PATCH_TRUNCATED_2 \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -3,7 +3,7 @@ this is some context!\n" \
	" around some lines\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define PATCH_TRUNCATED_3 \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -3,7 +3,7 @@ this is some context!\n" \
	" around some lines\n" \
	" that will change\n" \
	" yes it is!\n" \
	"+(THIS line is changed!)\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n"

#define FILE_EMPTY_CONTEXT_ORIGINAL \
	"this\nhas\nan\n\nempty\ncontext\nline\n"

#define FILE_EMPTY_CONTEXT_MODIFIED \
	"this\nhas\nan\n\nempty...\ncontext\nline\n"

#define PATCH_EMPTY_CONTEXT \
	"diff --git a/file.txt b/file.txt\n" \
	"index 398d2df..bb15234 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -2,6 +2,6 @@ this\n" \
	" has\n" \
	" an\n" \
	"\n" \
	"-empty\n" \
	"+empty...\n" \
	" context\n" \
	" line\n"

#define FILE_APPEND_NO_NL \
	"hey!\n" \
	"this is some context!\n" \
	"around some lines\n" \
	"that will change\n" \
	"yes it is!\n" \
	"(this line is changed)\n" \
	"and this\n" \
	"is additional context\n" \
	"below it!\n" \
	"added line with no nl"

#define PATCH_APPEND_NO_NL \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..83759c0 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -7,3 +7,4 @@ yes it is!\n" \
	" and this\n" \
	" is additional context\n" \
	" below it!\n" \
	"+added line with no nl\n" \
	"\\ No newline at end of file\n"

#define PATCH_APPEND_NO_NL_IN_OLD_FILE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..83759c0 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -1,1 +1,1 @@\n" \
	"-foo\n" \
	"\\ No newline at end of file\n" \
	"+foo\n"

#define PATCH_NAME_WHITESPACE \
	"diff --git a/file with spaces.txt b/file with spaces.txt\n" \
	"index 9432026..83759c0 100644\n" \
	"--- a/file with spaces.txt\n" \
	"+++ b/file with spaces.txt\n" \
	"@@ -0,3 +0,2 @@\n" \
	" and this\n" \
	"-is additional context\n" \
	" below it!\n" \

#define PATCH_CORRUPT_GIT_HEADER \
	"diff --git a/file.txt\n" \
	"index 9432026..0f39b9a 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -0,0 +1 @@\n" \
	"+insert at front\n"

#define PATCH_CORRUPT_MISSING_NEW_FILE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"@@ -6 +6 @@ yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n"

#define PATCH_CORRUPT_MISSING_OLD_FILE \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"+++ b/file.txt\n" \
	"@@ -6 +6 @@ yes it is!\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n"

#define PATCH_CORRUPT_NO_CHANGES \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"@@ -0,0 +0,0 @@ yes it is!\n"

#define PATCH_CORRUPT_MISSING_HUNK_HEADER \
	"diff --git a/file.txt b/file.txt\n" \
	"index 9432026..cd8fd12 100644\n" \
	"--- a/file.txt\n" \
	"+++ b/file.txt\n" \
	"-(this line is changed)\n" \
	"+(THIS line is changed!)\n"

#define PATCH_NOT_A_PATCH \
	"+++this is not\n" \
	"--actually even\n" \
	" a legitimate \n" \
	"+patch file\n" \
	"-it's something else\n" \
	" entirely!"

/* binary contents */

#define FILE_BINARY_LITERAL_ORIGINAL "\x00\x00\x0a"
#define FILE_BINARY_LITERAL_ORIGINAL_LEN 3

#define FILE_BINARY_LITERAL_MODIFIED "\x00\x00\x01\x02\x0a"
#define FILE_BINARY_LITERAL_MODIFIED_LEN 5

#define PATCH_BINARY_LITERAL \
	"diff --git a/binary.bin b/binary.bin\n" \
	"index bd474b2519cc15eab801ff851cc7d50f0dee49a1..9ac35ff15cd8864aeafd889e4826a3150f0b06c4 100644\n" \
	"GIT binary patch\n" \
	"literal 5\n" \
	"Mc${NkU}WL~000&M4gdfE\n" \
	"\n" \
	"literal 3\n" \
	"Kc${Nk-~s>u4FC%O\n\n"

#define FILE_BINARY_DELTA_ORIGINAL \
	"\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02\x0a\x54\x68\x69" \
	"\x73\x20\x69\x73\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x66\x69" \
	"\x6c\x65\x2c\x20\x62\x79\x20\x76\x69\x72\x74\x75\x65\x20\x6f\x66" \
	"\x20\x68\x61\x76\x69\x6e\x67\x20\x73\x6f\x6d\x65\x20\x6e\x75\x6c" \
	"\x6c\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \
	"\x0a\x57\x65\x27\x72\x65\x20\x67\x6f\x69\x6e\x67\x20\x74\x6f\x20" \
	"\x63\x68\x61\x6e\x67\x65\x20\x70\x6f\x72\x74\x69\x6f\x6e\x73\x20" \
	"\x6f\x66\x20\x69\x74\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00" \
	"\x00\x01\x02\x0a\x53\x6f\x20\x74\x68\x61\x74\x20\x77\x65\x20\x67" \
	"\x69\x74\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x64\x65\x6c\x74" \
	"\x61\x20\x69\x6e\x73\x74\x65\x61\x64\x20\x6f\x66\x20\x74\x68\x65" \
	"\x20\x64\x65\x66\x6c\x61\x74\x65\x64\x20\x63\x6f\x6e\x74\x65\x6e" \
	"\x74\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \
	"\x0a"
#define FILE_BINARY_DELTA_ORIGINAL_LEN 209

#define FILE_BINARY_DELTA_MODIFIED \
	"\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02\x0a\x5a\x5a\x5a" \
	"\x5a\x20\x69\x73\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x66\x69" \
	"\x6c\x65\x2c\x20\x62\x79\x20\x76\x69\x72\x74\x75\x65\x20\x6f\x66" \
	"\x20\x68\x61\x76\x69\x6e\x67\x20\x73\x6f\x6d\x65\x20\x6e\x75\x6c" \
	"\x6c\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \
	"\x0a\x57\x65\x27\x72\x65\x20\x67\x6f\x69\x6e\x67\x20\x74\x6f\x20" \
	"\x63\x68\x61\x6e\x67\x65\x20\x70\x6f\x72\x74\x69\x6f\x6e\x73\x20" \
	"\x6f\x66\x20\x49\x54\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00" \
	"\x00\x01\x02\x0a\x53\x4f\x20\x74\x68\x61\x74\x20\x77\x65\x20\x67" \
	"\x69\x74\x20\x61\x20\x62\x69\x6e\x61\x72\x79\x20\x64\x65\x6c\x74" \
	"\x61\x20\x69\x6e\x73\x74\x65\x61\x64\x20\x6f\x66\x20\x74\x68\x65" \
	"\x20\x64\x65\x66\x6c\x61\x74\x65\x64\x20\x63\x6f\x6e\x74\x65\x6e" \
	"\x74\x73\x2e\x0a\x00\x00\x01\x02\x00\x00\x01\x02\x00\x00\x01\x02" \
	"\x0a"
#define FILE_BINARY_DELTA_MODIFIED_LEN 209

#define PATCH_BINARY_DELTA \
	"diff --git a/binary.bin b/binary.bin\n" \
	"index 27184d9883b12c4c9c54b4a31137603586169f51..7c94f9e60bf366033d98e0d551ae37d30faef74a 100644\n" \
	"GIT binary patch\n" \
	"delta 48\n" \
	"kc$~Y)c#%<%fq{_;hPk4EV4`4>uxE%K7m7r%|HL+L0In7XGynhq\n" \
	"\n" \
	"delta 48\n" \
	"mc$~Y)c#%<%fq{_;hPgsAGK(h)CJASj=y9P)1m{m|^9BI99|yz$\n\n"

#define PATCH_BINARY_ADD \
	"diff --git a/binary.bin b/binary.bin\n" \
	"new file mode 100644\n" \
	"index 0000000000000000000000000000000000000000..7c94f9e60bf366033d98e0d551ae37d30faef74a\n" \
	"GIT binary patch\n" \
	"literal 209\n" \
	"zc${60u?oUK5JXSQe8qG&;(u6KC<u0&+$Ohh?#kUJlD{_rLCL^0!@QXgcKh&k^H>C_\n" \
	"zAhe=XX7rNzh<3&##YcwqNHmEKsP<&&m~%Zf;eX@Khr$?aExDmfqyyt+#l^I)3+LMg\n" \
	"kxnAIj9Pfn_|Gh`fP7tlm6j#y{FJYg_IifRlR^R@A08f862mk;8\n" \
	"\n" \
	"literal 0\n" \
	"Hc$@<O00001\n\n"

#define PATCH_BINARY_DELETE \
	"diff --git a/binary.bin b/binary.bin\n" \
	"deleted file mode 100644\n" \
	"index 7c94f9e60bf366033d98e0d551ae37d30faef74a..0000000000000000000000000000000000000000\n" \
	"GIT binary patch\n" \
	"literal 0\n" \
	"Hc$@<O00001\n" \
	"\n" \
	"literal 209\n" \
	"zc${60u?oUK5JXSQe8qG&;(u6KC<u0&+$Ohh?#kUJlD{_rLCL^0!@QXgcKh&k^H>C_\n" \
	"zAhe=XX7rNzh<3&##YcwqNHmEKsP<&&m~%Zf;eX@Khr$?aExDmfqyyt+#l^I)3+LMg\n" \
	"kxnAIj9Pfn_|Gh`fP7tlm6j#y{FJYg_IifRlR^R@A08f862mk;8\n\n"

/* contains an old side that does not match the expected source */
#define PATCH_BINARY_NOT_REVERSIBLE \
	"diff --git a/binary.bin b/binary.bin\n" \
	"index 27184d9883b12c4c9c54b4a31137603586169f51..7c94f9e60bf366033d98e0d551ae37d30faef74a 100644\n" \
	"GIT binary patch\n" \
	"literal 5\n" \
	"Mc${NkU}WL~000&M4gdfE\n" \
	"\n" \
	"delta 48\n" \
	"mc$~Y)c#%<%fq{_;hPgsAGK(h)CJASj=y9P)1m{m|^9BI99|yz$\n\n"

#define PATCH_BINARY_NOT_PRINTED \
	"diff --git a/binary.bin b/binary.bin\n" \
	"index 27184d9..7c94f9e 100644\n" \
	"Binary files a/binary.bin and b/binary.bin differ\n"

#define PATCH_ADD_BINARY_NOT_PRINTED \
	"diff --git a/test.bin b/test.bin\n" \
	"new file mode 100644\n" \
	"index 0000000..9e0f96a\n" \
	"Binary files /dev/null and b/test.bin differ\n"

#define PATCH_ORIGINAL_NEW_FILE_WITH_SPACE \
	"diff --git a/sp ace.txt b/sp ace.txt\n" \
	"new file mode 100644\n" \
	"index 000000000..789819226\n" \
	"--- /dev/null\n" \
	"+++ b/sp ace.txt\n" \
	"@@ -0,0 +1 @@\n" \
	"+a\n"

#define PATCH_DELETE_FILE_WITH_SPACE \
	"diff --git a/sp ace.txt b/sp ace.txt\n" \
	"deleted file mode 100644\n" \
	"index 789819226..000000000\n" \
	"--- a/sp ace.txt\n" \
	"+++ /dev/null\n" \
	"@@ -1 +0,0 @@\n" \
	"-a\n"

#define PATCH_CRLF \
	"diff --git a/test-file b/test-file\r\n" \
	"new file mode 100644\r\n" \
	"index 0000000..af431f2 100644\r\n" \
	"--- /dev/null\r\n" \
	"+++ b/test-file\r\n" \
	"@@ -0,0 +1 @@\r\n" \
	"+a contents\r\n"

#define PATCH_NO_EXTENDED_HEADERS \
	"diff --git a/file b/file\n" \
	"--- a/file\n" \
	"+++ b/file\n" \
	"@@ -1,3 +1,3 @@\n" \
	" a\n" \
	"-b\n" \
	"+bb\n" \
	" c\n"

#define PATCH_BINARY_FILE_WITH_MISSING_PATHS \
	"diff --git  \n" \
	"--- \n" \
	"+++ \n" \
	"Binary files "

#define PATCH_BINARY_FILE_WITH_WHITESPACE_PATHS \
	"diff --git a/file b/file\n" \
	"---  \n" \
	"+++  \n" \
	"Binary files "

#define PATCH_BINARY_FILE_WITH_QUOTED_EMPTY_PATHS \
	"diff --git a/file b/file\n" \
	"--- \"\"\n" \
	"+++ \"\"\n" \
	"Binary files "

#define PATCH_BINARY_FILE_PATH_WITH_SPACES \
	"diff --git a b c d e f\n" \
	"--- a b c\n" \
	"+++ d e f\n" \
	"Binary files a b c and d e f differ"

#define PATCH_BINARY_FILE_PATH_WITHOUT_BODY_PATHS \
	"diff --git a b c d e f\n" \
	"--- \n" \
	"+++ \n" \
	"Binary files a b c and d e f differ"

#define PATCH_BINARY_FILE_WITH_TRUNCATED_DELTA \
	"diff --git a/file b/file\n" \
	"index 1420..b71f\n" \
	"GIT binary patch\n" \
	"delta 7\n" \
	"d"

#define PATCH_MULTIPLE_OLD_PATHS \
	"diff --git  \n" \
	"---  \n" \
	"+++ \n" \
	"index 0000..7DDb\n" \
	"--- \n"

#define PATCH_INTMAX_NEW_LINES \
	"diff --git a/file b/file\n" \
	"--- a/file\n" \
	"+++ b/file\n" \
	"@@ -0 +2147483647 @@\n" \
	"\n" \
	"  "