Commit 3ff1d123736e5686fb9ec16e65828d5b8ffa2b30

Russell Belfer 2013-10-11T14:51:54

Rename diff objects and split patch.h This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.

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
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
diff --git a/examples/diff.c b/examples/diff.c
index 11efa21..3200b53 100644
--- a/examples/diff.c
+++ b/examples/diff.c
@@ -45,7 +45,7 @@ char *colors[] = {
 
 static int printer(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char usage,
 	const char *line,
 	size_t line_len,
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
 	git_tree *t1 = NULL, *t2 = NULL;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
-	git_diff_list *diff;
+	git_diff *diff;
 	int i, color = -1, format = FORMAT_PATCH, cached = 0;
 	char *a, *treeish1 = NULL, *treeish2 = NULL;
 	const char *dir = ".";
@@ -218,11 +218,11 @@ int main(int argc, char *argv[])
 	else if (t1 && cached)
 		check(git_diff_tree_to_index(&diff, repo, t1, NULL, &opts), "Diff");
 	else if (t1) {
-		git_diff_list *diff2;
+		git_diff *diff2;
 		check(git_diff_tree_to_index(&diff, repo, t1, NULL, &opts), "Diff");
 		check(git_diff_index_to_workdir(&diff2, repo, NULL, &opts), "Diff");
 		check(git_diff_merge(diff, diff2), "Merge diffs");
-		git_diff_list_free(diff2);
+		git_diff_free(diff2);
 	}
 	else if (cached) {
 		check(resolve_to_tree(repo, "HEAD", &t1), "looking up HEAD");
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
 	if (color >= 0)
 		fputs(colors[0], stdout);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(t1);
 	git_tree_free(t2);
 	git_repository_free(repo);
diff --git a/examples/log.c b/examples/log.c
index 413c211..2ba5aa5 100644
--- a/examples/log.c
+++ b/examples/log.c
@@ -184,7 +184,7 @@ static void print_commit(git_commit *commit)
 
 static int print_diff(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char usage,
 	const char *line,
 	size_t line_len,
@@ -218,7 +218,7 @@ static int match_with_parent(
 {
 	git_commit *parent;
 	git_tree *a, *b;
-	git_diff_list *diff;
+	git_diff *diff;
 	int ndeltas;
 
 	check(git_commit_parent(&parent, commit, (size_t)i), "Get parent", NULL);
@@ -229,7 +229,7 @@ static int match_with_parent(
 
 	ndeltas = (int)git_diff_num_deltas(diff);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(a);
 	git_tree_free(b);
 	git_commit_free(parent);
@@ -373,7 +373,7 @@ int main(int argc, char *argv[])
 
 		if (opt.show_diff) {
 			git_tree *a = NULL, *b = NULL;
-			git_diff_list *diff = NULL;
+			git_diff *diff = NULL;
 
 			if (parents > 1)
 				continue;
@@ -391,7 +391,7 @@ int main(int argc, char *argv[])
 			check(git_diff_print_patch(diff, print_diff, NULL),
 				"Displaying diff", NULL);
 
-			git_diff_list_free(diff);
+			git_diff_free(diff);
 			git_tree_free(a);
 			git_tree_free(b);
 		}
diff --git a/include/git2.h b/include/git2.h
index 93049aa..b906739 100644
--- a/include/git2.h
+++ b/include/git2.h
@@ -32,6 +32,7 @@
 #include "git2/odb.h"
 #include "git2/oid.h"
 #include "git2/pack.h"
+#include "git2/patch.h"
 #include "git2/pathspec.h"
 #include "git2/push.h"
 #include "git2/refdb.h"
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 5960985..11c3bce 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -20,34 +20,38 @@
  * Overview
  * --------
  *
- * Calculating diffs is generally done in two phases: building a diff list
- * then traversing the diff list.  This makes is easier to share logic
- * across the various types of diffs (tree vs tree, workdir vs index, etc.),
- * and also allows you to insert optional diff list post-processing phases,
- * such as rename detected, in between the steps.  When you are done with a
- * diff list object, it must be freed.
+ * Calculating diffs is generally done in two phases: building a list of
+ * diffs then traversing it.  This makes is easier to share logic across
+ * the various types of diffs (tree vs tree, workdir vs index, etc.), and
+ * also allows you to insert optional diff list post-processing phases,
+ * such as rename detection, in between the steps.  When you are done with
+ * a diff object, it must be freed.
  *
  * Terminology
  * -----------
  *
  * To understand the diff APIs, you should know the following terms:
  *
- * - A `diff` or `diff list` represents the cumulative list of differences
- *   between two snapshots of a repository (possibly filtered by a set of
- *   file name patterns).  This is the `git_diff_list` object.
+ * - A `diff` represents the cumulative list of differences between two
+ *   snapshots of a repository (possibly filtered by a set of file name
+ *   patterns).  This is the `git_diff` object.
+ *
  * - A `delta` is a file pair with an old and new revision.  The old version
  *   may be absent if the file was just created and the new version may be
  *   absent if the file was deleted.  A diff is mostly just a list of deltas.
+ *
  * - A `binary` file / delta is a file (or pair) for which no text diffs
- *   should be generated.  A diff list can contain delta entries that are
+ *   should be generated.  A diff can contain delta entries that are
  *   binary, but no diff content will be output for those files.  There is
  *   a base heuristic for binary detection and you can further tune the
  *   behavior with git attributes or diff flags and option settings.
+ *
  * - A `hunk` is a span of modified lines in a delta along with some stable
  *   surrounding context.  You can configure the amount of context and other
  *   properties of how hunks are generated.  Each hunk also comes with a
  *   header that described where it starts and ends in both the old and new
  *   versions in the delta.
+ *
  * - A `line` is a range of characters inside a hunk.  It could be a context
  *   line (i.e. in both old and new versions), an added line (i.e. only in
  *   the new version), or a removed line (i.e. only in the old version).
@@ -154,14 +158,14 @@ typedef enum {
 } git_diff_option_t;
 
 /**
- * The diff list object that contains all individual file deltas.
+ * The diff object that contains all individual file deltas.
  *
  * This is an opaque structure which will be allocated by one of the diff
  * generator functions below (such as `git_diff_tree_to_tree`).  You are
  * responsible for releasing the object memory when done, using the
- * `git_diff_list_free()` function.
+ * `git_diff_free()` function.
  */
-typedef struct git_diff_list git_diff_list;
+typedef struct git_diff git_diff;
 
 /**
  * Flags for the delta object and the file objects on each side.
@@ -200,11 +204,11 @@ typedef enum {
 } git_delta_t;
 
 /**
- * Description of one side of a diff entry.
+ * Description of one side of a delta.
  *
- * Although this is called a "file", it may actually represent a file, a
- * symbolic link, a submodule commit id, or even a tree (although that only
- * if you are tracking type changes or ignored/untracked directories).
+ * Although this is called a "file", it could represent a file, a symbolic
+ * link, a submodule commit id, or even a tree (although that only if you
+ * are tracking type changes or ignored/untracked directories).
  *
  * The `oid` is the `git_oid` of the item.  If the entry represents an
  * absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
@@ -231,9 +235,8 @@ typedef struct {
 /**
  * Description of changes to one entry.
  *
- * When iterating over a diff list object, this will be passed to most
- * callback functions and you can use the contents to understand exactly
- * what has changed.
+ * When iterating over a diff, this will be passed to most callbacks and
+ * you can use the contents to understand exactly what has changed.
  *
  * The `old_file` represents the "from" side of the diff and the `new_file`
  * represents to "to" side of the diff.  What those means depend on the
@@ -266,18 +269,18 @@ typedef struct {
  * the score (a la `printf("M%03d", 100 - delta->similarity)`).
  */
 typedef struct {
-	git_diff_file old_file;
-	git_diff_file new_file;
 	git_delta_t   status;
 	uint32_t      similarity; /**< for RENAMED and COPIED, value 0-100 */
 	uint32_t      flags;
+	git_diff_file old_file;
+	git_diff_file new_file;
 } git_diff_delta;
 
 /**
  * Diff notification callback function.
  *
  * The callback will be called for each file, just before the `git_delta_t`
- * gets inserted into the diff list.
+ * gets inserted into the diff.
  *
  * When the callback:
  * - returns < 0, the diff process will be aborted.
@@ -287,7 +290,7 @@ typedef struct {
  *		continues.
  */
 typedef int (*git_diff_notify_cb)(
-	const git_diff_list *diff_so_far,
+	const git_diff *diff_so_far,
 	const git_diff_delta *delta_to_add,
 	const char *matched_pathspec,
 	void *payload);
@@ -349,19 +352,20 @@ typedef int (*git_diff_file_cb)(
 /**
  * Structure describing a hunk of a diff.
  */
-typedef struct {
+typedef struct git_diff_hunk git_diff_hunk;
+struct git_diff_hunk {
 	int old_start; /** Starting line number in old_file */
 	int old_lines; /** Number of lines in old_file */
 	int new_start; /** Starting line number in new_file */
 	int new_lines; /** Number of lines in new_file */
-} git_diff_range;
+};
 
 /**
  * When iterating over a diff, callback that will be made per hunk.
  */
 typedef int (*git_diff_hunk_cb)(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *hunk,
 	const char *header,
 	size_t header_len,
 	void *payload);
@@ -370,13 +374,13 @@ typedef int (*git_diff_hunk_cb)(
  * Line origin constants.
  *
  * These values describe where a line came from and will be passed to
- * the git_diff_data_cb when iterating over a diff.  There are some
+ * the git_diff_line_cb when iterating over a diff.  There are some
  * special origin constants at the end that are used for the text
  * output callbacks to demarcate lines that are actually part of
  * the file or hunk headers.
  */
 typedef enum {
-	/* These values will be sent to `git_diff_data_cb` along with the line */
+	/* These values will be sent to `git_diff_line_cb` along with the line */
 	GIT_DIFF_LINE_CONTEXT   = ' ',
 	GIT_DIFF_LINE_ADDITION  = '+',
 	GIT_DIFF_LINE_DELETION  = '-',
@@ -385,7 +389,7 @@ typedef enum {
 	GIT_DIFF_LINE_ADD_EOFNL = '>',     /**< Old has no LF at end, new does */
 	GIT_DIFF_LINE_DEL_EOFNL = '<',     /**< Old has LF at end, new does not */
 
-	/* The following values will only be sent to a `git_diff_data_cb` when
+	/* The following values will only be sent to a `git_diff_line_cb` when
 	 * the content of a diff is being formatted (eg. through
 	 * git_diff_print_patch() or git_diff_print_compact(), for instance).
 	 */
@@ -402,23 +406,15 @@ typedef enum {
  * of text.  This uses some extra GIT_DIFF_LINE_... constants for output
  * of lines of file and hunk headers.
  */
-typedef int (*git_diff_data_cb)(
+typedef int (*git_diff_line_cb)(
 	const git_diff_delta *delta, /** delta that contains this data */
-	const git_diff_range *range, /** range of lines containing this data */
-	char line_origin,            /** git_diff_list_t value from above */
+	const git_diff_hunk *hunk,   /** range of lines containing this data */
+	char line_origin,            /** git_diff_t value from above */
 	const char *content,         /** diff data - not NUL terminated */
 	size_t content_len,          /** number of bytes of diff data */
 	void *payload);              /** user reference data */
 
 /**
- * The diff patch is used to store all the text diffs for a delta.
- *
- * You can easily loop over the content of patches and get information about
- * them.
- */
-typedef struct git_diff_patch git_diff_patch;
-
-/**
  * Flags to control the behavior of diff rename/copy detection.
  */
 typedef enum {
@@ -524,7 +520,7 @@ typedef struct {
 /** @name Diff List Generator Functions
  *
  * These are the functions you would use to create (or destroy) a
- * git_diff_list from various objects in a repository.
+ * git_diff from various objects in a repository.
  */
 /**@{*/
 
@@ -533,7 +529,7 @@ typedef struct {
  *
  * @param diff The previously created diff list; cannot be used after free.
  */
-GIT_EXTERN(void) git_diff_list_free(git_diff_list *diff);
+GIT_EXTERN(void) git_diff_free(git_diff *diff);
 
 /**
  * Create a diff list with the difference between two tree objects.
@@ -545,14 +541,14 @@ GIT_EXTERN(void) git_diff_list_free(git_diff_list *diff);
  * pass NULL to indicate an empty tree, although it is an error to pass
  * NULL for both the `old_tree` and `new_tree`.
  *
- * @param diff Output pointer to a git_diff_list pointer to be allocated.
+ * @param diff Output pointer to a git_diff pointer to be allocated.
  * @param repo The repository containing the trees.
  * @param old_tree A git_tree object to diff from, or NULL for empty tree.
  * @param new_tree A git_tree object to diff to, or NULL for empty tree.
  * @param opts Structure with options to influence diff or NULL for defaults.
  */
 GIT_EXTERN(int) git_diff_tree_to_tree(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_tree *old_tree,
 	git_tree *new_tree,
@@ -567,14 +563,14 @@ GIT_EXTERN(int) git_diff_tree_to_tree(
  * The tree you pass will be used for the "old_file" side of the delta, and
  * the index will be used for the "new_file" side of the delta.
  *
- * @param diff Output pointer to a git_diff_list pointer to be allocated.
+ * @param diff Output pointer to a git_diff pointer to be allocated.
  * @param repo The repository containing the tree and index.
  * @param old_tree A git_tree object to diff from, or NULL for empty tree.
  * @param index The index to diff with; repo index used if NULL.
  * @param opts Structure with options to influence diff or NULL for defaults.
  */
 GIT_EXTERN(int) git_diff_tree_to_index(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_tree *old_tree,
 	git_index *index,
@@ -591,13 +587,13 @@ GIT_EXTERN(int) git_diff_tree_to_index(
  * The index will be used for the "old_file" side of the delta, and the
  * working directory will be used for the "new_file" side of the delta.
  *
- * @param diff Output pointer to a git_diff_list pointer to be allocated.
+ * @param diff Output pointer to a git_diff pointer to be allocated.
  * @param repo The repository.
  * @param index The index to diff from; repo index used if NULL.
  * @param opts Structure with options to influence diff or NULL for defaults.
  */
 GIT_EXTERN(int) git_diff_index_to_workdir(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_index *index,
 	const git_diff_options *opts); /**< can be NULL for defaults */
@@ -619,20 +615,20 @@ GIT_EXTERN(int) git_diff_index_to_workdir(
  *
  * To emulate `git diff <treeish>`, call both `git_diff_tree_to_index` and
  * `git_diff_index_to_workdir`, then call `git_diff_merge` on the results.
- * That will yield a `git_diff_list` that matches the git output.
+ * That will yield a `git_diff` that matches the git output.
  *
  * If this seems confusing, take the case of a file with a staged deletion
  * where the file has then been put back into the working dir and modified.
  * The tree-to-workdir diff for that file is 'modified', but core git would
  * show status 'deleted' since there is a pending deletion in the index.
  *
- * @param diff A pointer to a git_diff_list pointer that will be allocated.
+ * @param diff A pointer to a git_diff pointer that will be allocated.
  * @param repo The repository containing the tree.
  * @param old_tree A git_tree object to diff from, or NULL for empty tree.
  * @param opts Structure with options to influence diff or NULL for defaults.
  */
 GIT_EXTERN(int) git_diff_tree_to_workdir(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_tree *old_tree,
 	const git_diff_options *opts); /**< can be NULL for defaults */
@@ -651,8 +647,8 @@ GIT_EXTERN(int) git_diff_tree_to_workdir(
  * @param from Diff to merge.
  */
 GIT_EXTERN(int) git_diff_merge(
-	git_diff_list *onto,
-	const git_diff_list *from);
+	git_diff *onto,
+	const git_diff *from);
 
 /**
  * Transform a diff list marking file renames, copies, etc.
@@ -667,7 +663,7 @@ GIT_EXTERN(int) git_diff_merge(
  * @return 0 on success, -1 on failure
  */
 GIT_EXTERN(int) git_diff_find_similar(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_diff_find_options *options);
 
 /**@}*/
@@ -694,7 +690,7 @@ GIT_EXTERN(int) git_diff_find_similar(
  * Returning a non-zero value from any of the callbacks will terminate
  * the iteration and cause this return `GIT_EUSER`.
  *
- * @param diff A git_diff_list generated by one of the above functions.
+ * @param diff A git_diff generated by one of the above functions.
  * @param file_cb Callback function to make per file in the diff.
  * @param hunk_cb Optional callback to make per hunk of text diff.  This
  *                callback is called to describe a range of lines in the
@@ -706,10 +702,10 @@ GIT_EXTERN(int) git_diff_find_similar(
  * @return 0 on success, GIT_EUSER on non-zero callback, or error code
  */
 GIT_EXTERN(int) git_diff_foreach(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb line_cb,
+	git_diff_line_cb line_cb,
 	void *payload);
 
 /**
@@ -718,14 +714,14 @@ GIT_EXTERN(int) git_diff_foreach(
  * Returning a non-zero value from the callbacks will terminate the
  * iteration and cause this return `GIT_EUSER`.
  *
- * @param diff A git_diff_list generated by one of the above functions.
+ * @param diff A git_diff generated by one of the above functions.
  * @param print_cb Callback to make per line of diff text.
  * @param payload Reference pointer that will be passed to your callback.
  * @return 0 on success, GIT_EUSER on non-zero callback, or error code
  */
 GIT_EXTERN(int) git_diff_print_compact(
-	git_diff_list *diff,
-	git_diff_data_cb print_cb,
+	git_diff *diff,
+	git_diff_line_cb print_cb,
 	void *payload);
 
 /**
@@ -734,14 +730,14 @@ GIT_EXTERN(int) git_diff_print_compact(
  * Returning a non-zero value from the callbacks will terminate the
  * iteration and cause this return `GIT_EUSER`.
  *
- * @param diff A git_diff_list generated by one of the above functions.
+ * @param diff A git_diff generated by one of the above functions.
  * @param print_cb Callback to make per line of diff text.
  * @param payload Reference pointer that will be passed to your callback.
  * @return 0 on success, GIT_EUSER on non-zero callback, or error code
  */
 GIT_EXTERN(int) git_diff_print_raw(
-	git_diff_list *diff,
-	git_diff_data_cb print_cb,
+	git_diff *diff,
+	git_diff_line_cb print_cb,
 	void *payload);
 
 /**
@@ -766,7 +762,7 @@ GIT_EXTERN(char) git_diff_status_char(git_delta_t status);
  * Returning a non-zero value from the callbacks will terminate the
  * iteration and cause this return `GIT_EUSER`.
  *
- * @param diff A git_diff_list generated by one of the above functions.
+ * @param diff A git_diff generated by one of the above functions.
  * @param payload Reference pointer that will be passed to your callbacks.
  * @param print_cb Callback function to output lines of the diff.  This
  *                 same function will be called for file headers, hunk
@@ -776,17 +772,17 @@ GIT_EXTERN(char) git_diff_status_char(git_delta_t status);
  * @return 0 on success, GIT_EUSER on non-zero callback, or error code
  */
 GIT_EXTERN(int) git_diff_print_patch(
-	git_diff_list *diff,
-	git_diff_data_cb print_cb,
+	git_diff *diff,
+	git_diff_line_cb print_cb,
 	void *payload);
 
 /**
  * Query how many diff records are there in a diff list.
  *
- * @param diff A git_diff_list generated by one of the above functions
+ * @param diff A git_diff generated by one of the above functions
  * @return Count of number of deltas in the list
  */
-GIT_EXTERN(size_t) git_diff_num_deltas(git_diff_list *diff);
+GIT_EXTERN(size_t) git_diff_num_deltas(git_diff *diff);
 
 /**
  * Query how many diff deltas are there in a diff list filtered by type.
@@ -795,12 +791,12 @@ GIT_EXTERN(size_t) git_diff_num_deltas(git_diff_list *diff);
  * that is a `git_delta_t` and returns just the count of how many deltas
  * match that particular type.
  *
- * @param diff A git_diff_list generated by one of the above functions
+ * @param diff A git_diff generated by one of the above functions
  * @param type A git_delta_t value to filter the count
  * @return Count of number of deltas matching delta_t type
  */
 GIT_EXTERN(size_t) git_diff_num_deltas_of_type(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_delta_t type);
 
 /**
@@ -809,191 +805,7 @@ GIT_EXTERN(size_t) git_diff_num_deltas_of_type(
  * @param diff Diff list to check
  * @return 0 if case sensitive, 1 if case is ignored
  */
-GIT_EXTERN(int) git_diff_is_sorted_icase(const git_diff_list *diff);
-
-/**
- * Return the diff delta and patch for an entry in the diff list.
- *
- * The `git_diff_patch` is a newly created object contains the text diffs
- * for the delta.  You have to call `git_diff_patch_free()` when you are
- * done with it.  You can use the patch object to loop over all the hunks
- * and lines in the diff of the one delta.
- *
- * For an unchanged file or a binary file, no `git_diff_patch` will be
- * created, the output will be set to NULL, and the `binary` flag will be
- * set true in the `git_diff_delta` structure.
- *
- * The `git_diff_delta` pointer points to internal data and you do not have
- * to release it when you are done with it.  It will go away when the
- * `git_diff_list` and `git_diff_patch` go away.
- *
- * It is okay to pass NULL for either of the output parameters; if you pass
- * NULL for the `git_diff_patch`, then the text diff will not be calculated.
- *
- * @param patch_out Output parameter for the delta patch object
- * @param delta_out Output parameter for the delta object
- * @param diff Diff list object
- * @param idx Index into diff list
- * @return 0 on success, other value < 0 on error
- */
-GIT_EXTERN(int) git_diff_get_patch(
-	git_diff_patch **patch_out,
-	const git_diff_delta **delta_out,
-	git_diff_list *diff,
-	size_t idx);
-
-/**
- * Free a git_diff_patch object.
- */
-GIT_EXTERN(void) git_diff_patch_free(
-	git_diff_patch *patch);
-
-/**
- * Get the delta associated with a patch
- */
-GIT_EXTERN(const git_diff_delta *) git_diff_patch_delta(
-	git_diff_patch *patch);
-
-/**
- * Get the number of hunks in a patch
- */
-GIT_EXTERN(size_t) git_diff_patch_num_hunks(
-	git_diff_patch *patch);
-
-/**
- * Get line counts of each type in a patch.
- *
- * This helps imitate a diff --numstat type of output.  For that purpose,
- * you only need the `total_additions` and `total_deletions` values, but we
- * include the `total_context` line count in case you want the total number
- * of lines of diff output that will be generated.
- *
- * All outputs are optional. Pass NULL if you don't need a particular count.
- *
- * @param total_context Count of context lines in output, can be NULL.
- * @param total_additions Count of addition lines in output, can be NULL.
- * @param total_deletions Count of deletion lines in output, can be NULL.
- * @param patch The git_diff_patch object
- * @return 0 on success, <0 on error
- */
-GIT_EXTERN(int) git_diff_patch_line_stats(
-	size_t *total_context,
-	size_t *total_additions,
-	size_t *total_deletions,
-	const git_diff_patch *patch);
-
-/**
- * Get the information about a hunk in a patch
- *
- * Given a patch and a hunk index into the patch, this returns detailed
- * information about that hunk.  Any of the output pointers can be passed
- * as NULL if you don't care about that particular piece of information.
- *
- * @param range Output pointer to git_diff_range of hunk
- * @param header Output pointer to header string for hunk.  Unlike the
- *               content pointer for each line, this will be NUL-terminated
- * @param header_len Output value of characters in header string
- * @param lines_in_hunk Output count of total lines in this hunk
- * @param patch Input pointer to patch object
- * @param hunk_idx Input index of hunk to get information about
- * @return 0 on success, GIT_ENOTFOUND if hunk_idx out of range, <0 on error
- */
-GIT_EXTERN(int) git_diff_patch_get_hunk(
-	const git_diff_range **range,
-	const char **header,
-	size_t *header_len,
-	size_t *lines_in_hunk,
-	git_diff_patch *patch,
-	size_t hunk_idx);
-
-/**
- * Get the number of lines in a hunk.
- *
- * @param patch The git_diff_patch object
- * @param hunk_idx Index of the hunk
- * @return Number of lines in hunk or -1 if invalid hunk index
- */
-GIT_EXTERN(int) git_diff_patch_num_lines_in_hunk(
-	git_diff_patch *patch,
-	size_t hunk_idx);
-
-/**
- * Get data about a line in a hunk of a patch.
- *
- * Given a patch, a hunk index, and a line index in the hunk, this
- * will return a lot of details about that line.  If you pass a hunk
- * index larger than the number of hunks or a line index larger than
- * the number of lines in the hunk, this will return -1.
- *
- * @param line_origin A GIT_DIFF_LINE constant from above
- * @param content Pointer to content of diff line, not NUL-terminated
- * @param content_len Number of characters in content
- * @param old_lineno Line number in old file or -1 if line is added
- * @param new_lineno Line number in new file or -1 if line is deleted
- * @param patch The patch to look in
- * @param hunk_idx The index of the hunk
- * @param line_of_hunk The index of the line in the hunk
- * @return 0 on success, <0 on failure
- */
-GIT_EXTERN(int) git_diff_patch_get_line_in_hunk(
-	char *line_origin,
-	const char **content,
-	size_t *content_len,
-	int *old_lineno,
-	int *new_lineno,
-	git_diff_patch *patch,
-	size_t hunk_idx,
-	size_t line_of_hunk);
-
-/**
- * Look up size of patch diff data in bytes
- *
- * This returns the raw size of the patch data.  This only includes the
- * actual data from the lines of the diff, not the file or hunk headers.
- *
- * If you pass `include_context` as true (non-zero), this will be the size
- * of all of the diff output; if you pass it as false (zero), this will
- * only include the actual changed lines (as if `context_lines` was 0).
- *
- * @param patch A git_diff_patch representing changes to one file
- * @param include_context Include context lines in size if non-zero
- * @param include_hunk_headers Include hunk header lines if non-zero
- * @param include_file_headers Include file header lines if non-zero
- * @return The number of bytes of data
- */
-GIT_EXTERN(size_t) git_diff_patch_size(
-	git_diff_patch *patch,
-	int include_context,
-	int include_hunk_headers,
-	int include_file_headers);
-
-/**
- * Serialize the patch to text via callback.
- *
- * Returning a non-zero value from the callback will terminate the iteration
- * and cause this return `GIT_EUSER`.
- *
- * @param patch A git_diff_patch representing changes to one file
- * @param print_cb Callback function to output lines of the patch.  Will be
- *                 called for file headers, hunk headers, and diff lines.
- * @param payload Reference pointer that will be passed to your callbacks.
- * @return 0 on success, GIT_EUSER on non-zero callback, or error code
- */
-GIT_EXTERN(int) git_diff_patch_print(
-	git_diff_patch *patch,
-	git_diff_data_cb print_cb,
-	void *payload);
-
-/**
- * Get the content of a patch as a single diff text.
- *
- * @param string Allocated string; caller must free.
- * @param patch A git_diff_patch representing changes to one file
- * @return 0 on success, <0 on failure.
- */
-GIT_EXTERN(int) git_diff_patch_to_str(
-	char **string,
-	git_diff_patch *patch);
+GIT_EXTERN(int) git_diff_is_sorted_icase(const git_diff *diff);
 
 /**@}*/
 
@@ -1037,34 +849,10 @@ GIT_EXTERN(int) git_diff_blobs(
 	const git_diff_options *options,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb line_cb,
+	git_diff_line_cb line_cb,
 	void *payload);
 
 /**
- * Directly generate a patch from the difference between two blobs.
- *
- * This is just like `git_diff_blobs()` except it generates a patch object
- * for the difference instead of directly making callbacks.  You can use the
- * standard `git_diff_patch` accessor functions to read the patch data, and
- * you must call `git_diff_patch_free()` on the patch when done.
- *
- * @param out The generated patch; NULL on error
- * @param old_blob Blob for old side of diff, or NULL for empty blob
- * @param old_as_path Treat old blob as if it had this filename; can be NULL
- * @param new_blob Blob for new side of diff, or NULL for empty blob
- * @param new_as_path Treat new blob as if it had this filename; can be NULL
- * @param opts Options for diff, or NULL for default options
- * @return 0 on success or error code < 0
- */
-GIT_EXTERN(int) git_diff_patch_from_blobs(
-	git_diff_patch **out,
-	const git_blob *old_blob,
-	const char *old_as_path,
-	const git_blob *new_blob,
-	const char *new_as_path,
-	const git_diff_options *opts);
-
-/**
  * Directly run a diff between a blob and a buffer.
  *
  * As with `git_diff_blobs`, comparing a blob and buffer lacks some context,
@@ -1084,7 +872,7 @@ GIT_EXTERN(int) git_diff_patch_from_blobs(
  * @param options Options for diff, or NULL for default options
  * @param file_cb Callback for "file"; made once if there is a diff; can be NULL
  * @param hunk_cb Callback for each hunk in diff; can be NULL
- * @param data_cb Callback for each line in diff; can be NULL
+ * @param line_cb Callback for each line in diff; can be NULL
  * @param payload Payload passed to each callback function
  * @return 0 on success, GIT_EUSER on non-zero callback return, or error code
  */
@@ -1097,35 +885,9 @@ GIT_EXTERN(int) git_diff_blob_to_buffer(
 	const git_diff_options *options,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb data_cb,
+	git_diff_line_cb line_cb,
 	void *payload);
 
-/**
- * Directly generate a patch from the difference between a blob and a buffer.
- *
- * This is just like `git_diff_blob_to_buffer()` except it generates a patch
- * object for the difference instead of directly making callbacks.  You can
- * use the standard `git_diff_patch` accessor functions to read the patch
- * data, and you must call `git_diff_patch_free()` on the patch when done.
- *
- * @param out The generated patch; NULL on error
- * @param old_blob Blob for old side of diff, or NULL for empty blob
- * @param old_as_path Treat old blob as if it had this filename; can be NULL
- * @param buffer Raw data for new side of diff, or NULL for empty
- * @param buffer_len Length of raw data for new side of diff
- * @param buffer_as_path Treat buffer as if it had this filename; can be NULL
- * @param opts Options for diff, or NULL for default options
- * @return 0 on success or error code < 0
- */
-GIT_EXTERN(int) git_diff_patch_from_blob_and_buffer(
-	git_diff_patch **out,
-	const git_blob *old_blob,
-	const char *old_as_path,
-	const char *buffer,
-	size_t buffer_len,
-	const char *buffer_as_path,
-	const git_diff_options *opts);
-
 
 GIT_END_DECL
 
diff --git a/include/git2/patch.h b/include/git2/patch.h
new file mode 100644
index 0000000..ad9be75
--- /dev/null
+++ b/include/git2/patch.h
@@ -0,0 +1,270 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_git_patch_h__
+#define INCLUDE_git_patch_h__
+
+#include "common.h"
+#include "types.h"
+#include "oid.h"
+#include "diff.h"
+
+/**
+ * @file git2/patch.h
+ * @brief Patch handling routines.
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+/**
+ * The diff patch is used to store all the text diffs for a delta.
+ *
+ * You can easily loop over the content of patches and get information about
+ * them.
+ */
+typedef struct git_patch git_patch;
+
+/**
+ * Return the diff delta and patch for an entry in the diff list.
+ *
+ * The `git_patch` is a newly created object contains the text diffs
+ * for the delta.  You have to call `git_patch_free()` when you are
+ * done with it.  You can use the patch object to loop over all the hunks
+ * and lines in the diff of the one delta.
+ *
+ * For an unchanged file or a binary file, no `git_patch` will be
+ * created, the output will be set to NULL, and the `binary` flag will be
+ * set true in the `git_diff_delta` structure.
+ *
+ * The `git_diff_delta` pointer points to internal data and you do not have
+ * to release it when you are done with it.  It will go away when the
+ * `git_diff` and `git_patch` go away.
+ *
+ * It is okay to pass NULL for either of the output parameters; if you pass
+ * NULL for the `git_patch`, then the text diff will not be calculated.
+ *
+ * @param patch_out Output parameter for the delta patch object
+ * @param delta_out Output parameter for the delta object
+ * @param diff Diff list object
+ * @param idx Index into diff list
+ * @return 0 on success, other value < 0 on error
+ */
+GIT_EXTERN(int) git_patch_from_diff(
+	git_patch **patch_out,
+	const git_diff_delta **delta_out,
+	git_diff *diff,
+	size_t idx);
+
+/**
+ * Directly generate a patch from the difference between two blobs.
+ *
+ * This is just like `git_diff_blobs()` except it generates a patch object
+ * for the difference instead of directly making callbacks.  You can use the
+ * standard `git_patch` accessor functions to read the patch data, and
+ * you must call `git_patch_free()` on the patch when done.
+ *
+ * @param out The generated patch; NULL on error
+ * @param old_blob Blob for old side of diff, or NULL for empty blob
+ * @param old_as_path Treat old blob as if it had this filename; can be NULL
+ * @param new_blob Blob for new side of diff, or NULL for empty blob
+ * @param new_as_path Treat new blob as if it had this filename; can be NULL
+ * @param opts Options for diff, or NULL for default options
+ * @return 0 on success or error code < 0
+ */
+GIT_EXTERN(int) git_patch_from_blobs(
+	git_patch **out,
+	const git_blob *old_blob,
+	const char *old_as_path,
+	const git_blob *new_blob,
+	const char *new_as_path,
+	const git_diff_options *opts);
+
+/**
+ * Directly generate a patch from the difference between a blob and a buffer.
+ *
+ * This is just like `git_diff_blob_to_buffer()` except it generates a patch
+ * object for the difference instead of directly making callbacks.  You can
+ * use the standard `git_patch` accessor functions to read the patch
+ * data, and you must call `git_patch_free()` on the patch when done.
+ *
+ * @param out The generated patch; NULL on error
+ * @param old_blob Blob for old side of diff, or NULL for empty blob
+ * @param old_as_path Treat old blob as if it had this filename; can be NULL
+ * @param buffer Raw data for new side of diff, or NULL for empty
+ * @param buffer_len Length of raw data for new side of diff
+ * @param buffer_as_path Treat buffer as if it had this filename; can be NULL
+ * @param opts Options for diff, or NULL for default options
+ * @return 0 on success or error code < 0
+ */
+GIT_EXTERN(int) git_patch_from_blob_and_buffer(
+	git_patch **out,
+	const git_blob *old_blob,
+	const char *old_as_path,
+	const char *buffer,
+	size_t buffer_len,
+	const char *buffer_as_path,
+	const git_diff_options *opts);
+
+/**
+ * Free a git_patch object.
+ */
+GIT_EXTERN(void) git_patch_free(
+	git_patch *patch);
+
+/**
+ * Get the delta associated with a patch
+ */
+GIT_EXTERN(const git_diff_delta *) git_patch_delta(
+	git_patch *patch);
+
+/**
+ * Get the number of hunks in a patch
+ */
+GIT_EXTERN(size_t) git_patch_num_hunks(
+	git_patch *patch);
+
+/**
+ * Get line counts of each type in a patch.
+ *
+ * This helps imitate a diff --numstat type of output.  For that purpose,
+ * you only need the `total_additions` and `total_deletions` values, but we
+ * include the `total_context` line count in case you want the total number
+ * of lines of diff output that will be generated.
+ *
+ * All outputs are optional. Pass NULL if you don't need a particular count.
+ *
+ * @param total_context Count of context lines in output, can be NULL.
+ * @param total_additions Count of addition lines in output, can be NULL.
+ * @param total_deletions Count of deletion lines in output, can be NULL.
+ * @param patch The git_patch object
+ * @return 0 on success, <0 on error
+ */
+GIT_EXTERN(int) git_patch_line_stats(
+	size_t *total_context,
+	size_t *total_additions,
+	size_t *total_deletions,
+	const git_patch *patch);
+
+/**
+ * Get the information about a hunk in a patch
+ *
+ * Given a patch and a hunk index into the patch, this returns detailed
+ * information about that hunk.  Any of the output pointers can be passed
+ * as NULL if you don't care about that particular piece of information.
+ *
+ * @param out Output pointer to git_diff_hunk of hunk
+ * @param header Output pointer to header string for hunk.  Unlike the
+ *               content pointer for each line, this will be NUL-terminated
+ * @param header_len Output value of characters in header string
+ * @param lines_in_hunk Output count of total lines in this hunk
+ * @param patch Input pointer to patch object
+ * @param hunk_idx Input index of hunk to get information about
+ * @return 0 on success, GIT_ENOTFOUND if hunk_idx out of range, <0 on error
+ */
+GIT_EXTERN(int) git_patch_get_hunk(
+	const git_diff_hunk **out,
+	const char **header,
+	size_t *header_len,
+	size_t *lines_in_hunk,
+	git_patch *patch,
+	size_t hunk_idx);
+
+/**
+ * Get the number of lines in a hunk.
+ *
+ * @param patch The git_patch object
+ * @param hunk_idx Index of the hunk
+ * @return Number of lines in hunk or -1 if invalid hunk index
+ */
+GIT_EXTERN(int) git_patch_num_lines_in_hunk(
+	git_patch *patch,
+	size_t hunk_idx);
+
+/**
+ * Get data about a line in a hunk of a patch.
+ *
+ * Given a patch, a hunk index, and a line index in the hunk, this
+ * will return a lot of details about that line.  If you pass a hunk
+ * index larger than the number of hunks or a line index larger than
+ * the number of lines in the hunk, this will return -1.
+ *
+ * @param line_origin A GIT_DIFF_LINE constant from above
+ * @param content Pointer to content of diff line, not NUL-terminated
+ * @param content_len Number of characters in content
+ * @param old_lineno Line number in old file or -1 if line is added
+ * @param new_lineno Line number in new file or -1 if line is deleted
+ * @param patch The patch to look in
+ * @param hunk_idx The index of the hunk
+ * @param line_of_hunk The index of the line in the hunk
+ * @return 0 on success, <0 on failure
+ */
+GIT_EXTERN(int) git_patch_get_line_in_hunk(
+	char *line_origin,
+	const char **content,
+	size_t *content_len,
+	int *old_lineno,
+	int *new_lineno,
+	git_patch *patch,
+	size_t hunk_idx,
+	size_t line_of_hunk);
+
+/**
+ * Look up size of patch diff data in bytes
+ *
+ * This returns the raw size of the patch data.  This only includes the
+ * actual data from the lines of the diff, not the file or hunk headers.
+ *
+ * If you pass `include_context` as true (non-zero), this will be the size
+ * of all of the diff output; if you pass it as false (zero), this will
+ * only include the actual changed lines (as if `context_lines` was 0).
+ *
+ * @param patch A git_patch representing changes to one file
+ * @param include_context Include context lines in size if non-zero
+ * @param include_hunk_headers Include hunk header lines if non-zero
+ * @param include_file_headers Include file header lines if non-zero
+ * @return The number of bytes of data
+ */
+GIT_EXTERN(size_t) git_patch_size(
+	git_patch *patch,
+	int include_context,
+	int include_hunk_headers,
+	int include_file_headers);
+
+/**
+ * Serialize the patch to text via callback.
+ *
+ * Returning a non-zero value from the callback will terminate the iteration
+ * and cause this return `GIT_EUSER`.
+ *
+ * @param patch A git_patch representing changes to one file
+ * @param print_cb Callback function to output lines of the patch.  Will be
+ *                 called for file headers, hunk headers, and diff lines.
+ * @param payload Reference pointer that will be passed to your callbacks.
+ * @return 0 on success, GIT_EUSER on non-zero callback, or error code
+ */
+GIT_EXTERN(int) git_patch_print(
+	git_patch *patch,
+	git_diff_line_cb print_cb,
+	void *payload);
+
+/**
+ * Get the content of a patch as a single diff text.
+ *
+ * @param string Allocated string; caller must free.
+ * @param patch A git_patch representing changes to one file
+ * @return 0 on success, <0 on failure.
+ */
+GIT_EXTERN(int) git_patch_to_str(
+	char **string,
+	git_patch *patch);
+
+
+GIT_END_DECL
+
+/**@}*/
+
+#endif
diff --git a/include/git2/pathspec.h b/include/git2/pathspec.h
index a835f8e..2fb0bb7 100644
--- a/include/git2/pathspec.h
+++ b/include/git2/pathspec.h
@@ -187,7 +187,7 @@ GIT_EXTERN(int) git_pathspec_match_tree(
  */
 GIT_EXTERN(int) git_pathspec_match_diff(
 	git_pathspec_match_list **out,
-	git_diff_list *diff,
+	git_diff *diff,
 	uint32_t flags,
 	git_pathspec *ps);
 
diff --git a/src/checkout.c b/src/checkout.c
index d3f673d..6519ab5 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -43,7 +43,7 @@ enum {
 
 typedef struct {
 	git_repository *repo;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_checkout_opts opts;
 	bool opts_free_baseline;
 	char *pfx;
@@ -1320,7 +1320,7 @@ cleanup:
 		(data.strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
 		error = git_index_write(data.index);
 
-	git_diff_list_free(data.diff);
+	git_diff_free(data.diff);
 	git_iterator_free(workdir);
 	git_iterator_free(baseline);
 	git__free(actions);
diff --git a/src/diff.c b/src/diff.c
index 39facce..1efde98 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -21,7 +21,7 @@
 	(VAL) ? ((DIFF)->opts.flags | (FLAG)) : ((DIFF)->opts.flags & ~(VAL))
 
 static git_diff_delta *diff_delta__alloc(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_delta_t status,
 	const char *path)
 {
@@ -50,7 +50,7 @@ static git_diff_delta *diff_delta__alloc(
 }
 
 static int diff_notify(
-	const git_diff_list *diff,
+	const git_diff *diff,
 	const git_diff_delta *delta,
 	const char *matched_pathspec)
 {
@@ -62,7 +62,7 @@ static int diff_notify(
 }
 
 static int diff_delta__from_one(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_delta_t   status,
 	const git_index_entry *entry)
 {
@@ -120,7 +120,7 @@ static int diff_delta__from_one(
 }
 
 static int diff_delta__from_two(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_delta_t   status,
 	const git_index_entry *old_entry,
 	uint32_t old_mode,
@@ -181,7 +181,7 @@ static int diff_delta__from_two(
 }
 
 static git_diff_delta *diff_delta__last_for_item(
-	git_diff_list *diff,
+	git_diff *diff,
 	const git_index_entry *item)
 {
 	git_diff_delta *delta = git_vector_last(&diff->deltas);
@@ -340,13 +340,13 @@ static const char *diff_mnemonic_prefix(
 	return pfx;
 }
 
-static git_diff_list *diff_list_alloc(
+static git_diff *diff_list_alloc(
 	git_repository *repo,
 	git_iterator *old_iter,
 	git_iterator *new_iter)
 {
 	git_diff_options dflt = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = git__calloc(1, sizeof(git_diff_list));
+	git_diff *diff = git__calloc(1, sizeof(git_diff));
 	if (!diff)
 		return NULL;
 
@@ -360,7 +360,7 @@ static git_diff_list *diff_list_alloc(
 
 	if (git_vector_init(&diff->deltas, 0, git_diff_delta__cmp) < 0 ||
 		git_pool_init(&diff->pool, 1, 0) < 0) {
-		git_diff_list_free(diff);
+		git_diff_free(diff);
 		return NULL;
 	}
 
@@ -389,7 +389,7 @@ static git_diff_list *diff_list_alloc(
 }
 
 static int diff_list_apply_options(
-	git_diff_list *diff,
+	git_diff *diff,
 	const git_diff_options *opts)
 {
 	git_config *cfg;
@@ -490,7 +490,7 @@ static int diff_list_apply_options(
 	return 0;
 }
 
-static void diff_list_free(git_diff_list *diff)
+static void diff_list_free(git_diff *diff)
 {
 	git_diff_delta *delta;
 	unsigned int i;
@@ -508,7 +508,7 @@ static void diff_list_free(git_diff_list *diff)
 	git__free(diff);
 }
 
-void git_diff_list_free(git_diff_list *diff)
+void git_diff_free(git_diff *diff)
 {
 	if (!diff)
 		return;
@@ -516,7 +516,7 @@ void git_diff_list_free(git_diff_list *diff)
 	GIT_REFCOUNT_DEC(diff, diff_list_free);
 }
 
-void git_diff_list_addref(git_diff_list *diff)
+void git_diff_addref(git_diff *diff)
 {
 	GIT_REFCOUNT_INC(diff);
 }
@@ -612,7 +612,7 @@ typedef struct {
 static int maybe_modified_submodule(
 	git_delta_t *status,
 	git_oid *found_oid,
-	git_diff_list *diff,
+	git_diff *diff,
 	diff_in_progress *info)
 {
 	int error = 0;
@@ -659,7 +659,7 @@ static int maybe_modified_submodule(
 }
 
 static int maybe_modified(
-	git_diff_list *diff,
+	git_diff *diff,
 	diff_in_progress *info)
 {
 	git_oid noid;
@@ -778,7 +778,7 @@ static int maybe_modified(
 }
 
 static bool entry_is_prefixed(
-	git_diff_list *diff,
+	git_diff *diff,
 	const git_index_entry *item,
 	const git_index_entry *prefix_item)
 {
@@ -795,7 +795,7 @@ static bool entry_is_prefixed(
 }
 
 static int diff_scan_inside_untracked_dir(
-	git_diff_list *diff, diff_in_progress *info, git_delta_t *delta_type)
+	git_diff *diff, diff_in_progress *info, git_delta_t *delta_type)
 {
 	int error = 0;
 	git_buf base = GIT_BUF_INIT;
@@ -861,7 +861,7 @@ done:
 }
 
 static int handle_unmatched_new_item(
-	git_diff_list *diff, diff_in_progress *info)
+	git_diff *diff, diff_in_progress *info)
 {
 	int error = 0;
 	const git_index_entry *nitem = info->nitem;
@@ -1016,7 +1016,7 @@ static int handle_unmatched_new_item(
 }
 
 static int handle_unmatched_old_item(
-	git_diff_list *diff, diff_in_progress *info)
+	git_diff *diff, diff_in_progress *info)
 {
 	int error = diff_delta__from_one(diff, GIT_DELTA_DELETED, info->oitem);
 	if (error < 0)
@@ -1048,7 +1048,7 @@ static int handle_unmatched_old_item(
 }
 
 static int handle_matched_item(
-	git_diff_list *diff, diff_in_progress *info)
+	git_diff *diff, diff_in_progress *info)
 {
 	int error = 0;
 
@@ -1063,7 +1063,7 @@ static int handle_matched_item(
 }
 
 int git_diff__from_iterators(
-	git_diff_list **diff_ptr,
+	git_diff **diff_ptr,
 	git_repository *repo,
 	git_iterator *old_iter,
 	git_iterator *new_iter,
@@ -1071,7 +1071,7 @@ int git_diff__from_iterators(
 {
 	int error = 0;
 	diff_in_progress info;
-	git_diff_list *diff;
+	git_diff *diff;
 
 	*diff_ptr = NULL;
 
@@ -1132,7 +1132,7 @@ cleanup:
 	if (!error)
 		*diff_ptr = diff;
 	else
-		git_diff_list_free(diff);
+		git_diff_free(diff);
 
 	git_buf_free(&info.ignore_prefix);
 
@@ -1149,7 +1149,7 @@ cleanup:
 } while (0)
 
 int git_diff_tree_to_tree(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_tree *old_tree,
 	git_tree *new_tree,
@@ -1176,7 +1176,7 @@ int git_diff_tree_to_tree(
 }
 
 int git_diff_tree_to_index(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_tree *old_tree,
 	git_index *index,
@@ -1204,7 +1204,7 @@ int git_diff_tree_to_index(
 		git_index__set_ignore_case(index, true);
 
 		if (!error) {
-			git_diff_list *d = *diff;
+			git_diff *d = *diff;
 
 			d->opts.flags |= GIT_DIFF_DELTAS_ARE_ICASE;
 			d->strcomp    = git__strcasecmp;
@@ -1221,7 +1221,7 @@ int git_diff_tree_to_index(
 }
 
 int git_diff_index_to_workdir(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_index *index,
 	const git_diff_options *opts)
@@ -1244,7 +1244,7 @@ int git_diff_index_to_workdir(
 
 
 int git_diff_tree_to_workdir(
-	git_diff_list **diff,
+	git_diff **diff,
 	git_repository *repo,
 	git_tree *old_tree,
 	const git_diff_options *opts)
@@ -1262,13 +1262,13 @@ int git_diff_tree_to_workdir(
 	return error;
 }
 
-size_t git_diff_num_deltas(git_diff_list *diff)
+size_t git_diff_num_deltas(git_diff *diff)
 {
 	assert(diff);
 	return (size_t)diff->deltas.length;
 }
 
-size_t git_diff_num_deltas_of_type(git_diff_list *diff, git_delta_t type)
+size_t git_diff_num_deltas_of_type(git_diff *diff, git_delta_t type)
 {
 	size_t i, count = 0;
 	git_diff_delta *delta;
@@ -1282,14 +1282,14 @@ size_t git_diff_num_deltas_of_type(git_diff_list *diff, git_delta_t type)
 	return count;
 }
 
-int git_diff_is_sorted_icase(const git_diff_list *diff)
+int git_diff_is_sorted_icase(const git_diff *diff)
 {
 	return (diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) != 0;
 }
 
 int git_diff__paired_foreach(
-	git_diff_list *head2idx,
-	git_diff_list *idx2wd,
+	git_diff *head2idx,
+	git_diff *idx2wd,
 	int (*cb)(git_diff_delta *h2i, git_diff_delta *i2w, void *payload),
 	void *payload)
 {
diff --git a/src/diff.h b/src/diff.h
index bec7e27..270bea0 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -52,7 +52,7 @@ enum {
 
 #define GIT_DIFF__VERBOSE  (1 << 30)
 
-struct git_diff_list {
+struct git_diff {
 	git_refcount     rc;
 	git_repository   *repo;
 	git_diff_options opts;
@@ -72,7 +72,7 @@ struct git_diff_list {
 extern void git_diff__cleanup_modes(
 	uint32_t diffcaps, uint32_t *omode, uint32_t *nmode);
 
-extern void git_diff_list_addref(git_diff_list *diff);
+extern void git_diff_addref(git_diff *diff);
 
 extern int git_diff_delta__cmp(const void *a, const void *b);
 extern int git_diff_delta__casecmp(const void *a, const void *b);
@@ -93,15 +93,15 @@ extern int git_diff__oid_for_file(
 	git_repository *, const char *, uint16_t, git_off_t, git_oid *);
 
 extern int git_diff__from_iterators(
-	git_diff_list **diff_ptr,
+	git_diff **diff_ptr,
 	git_repository *repo,
 	git_iterator *old_iter,
 	git_iterator *new_iter,
 	const git_diff_options *opts);
 
 extern int git_diff__paired_foreach(
-	git_diff_list *idx2head,
-	git_diff_list *wd2idx,
+	git_diff *idx2head,
+	git_diff *wd2idx,
 	int (*cb)(git_diff_delta *i2h, git_diff_delta *w2i, void *payload),
 	void *payload);
 
diff --git a/src/diff_file.c b/src/diff_file.c
index 5939ee8..a7bca4d 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -88,7 +88,7 @@ static int diff_file_content_init_common(
 
 int git_diff_file_content__init_from_diff(
 	git_diff_file_content *fc,
-	git_diff_list *diff,
+	git_diff *diff,
 	size_t delta_index,
 	bool use_old)
 {
diff --git a/src/diff_file.h b/src/diff_file.h
index fb08cca..84bf255 100644
--- a/src/diff_file.h
+++ b/src/diff_file.h
@@ -27,7 +27,7 @@ typedef struct {
 
 extern int git_diff_file_content__init_from_diff(
 	git_diff_file_content *fc,
-	git_diff_list *diff,
+	git_diff *diff,
 	size_t delta_index,
 	bool use_old);
 
diff --git a/src/diff_patch.c b/src/diff_patch.c
index cc45b6d..a106944 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -24,16 +24,16 @@ struct diff_patch_line {
 /* cached information about a hunk in a diff */
 typedef struct diff_patch_hunk diff_patch_hunk;
 struct diff_patch_hunk {
-	git_diff_range range;
+	git_diff_hunk hunk;
 	char   header[128];
 	size_t header_len;
 	size_t line_start;
 	size_t line_count;
 };
 
-struct git_diff_patch {
+struct git_patch {
 	git_refcount rc;
-	git_diff_list *diff; /* for refcount purposes, maybe NULL for blob diffs */
+	git_diff *diff; /* for refcount purposes, maybe NULL for blob diffs */
 	git_diff_delta *delta;
 	size_t delta_index;
 	git_diff_file_content ofile;
@@ -56,11 +56,11 @@ enum {
 };
 
 static void diff_output_init(git_diff_output*, const git_diff_options*,
-	git_diff_file_cb, git_diff_hunk_cb, git_diff_data_cb, void*);
+	git_diff_file_cb, git_diff_hunk_cb, git_diff_line_cb, void*);
 
-static void diff_output_to_patch(git_diff_output *, git_diff_patch *);
+static void diff_output_to_patch(git_diff_output *, git_patch *);
 
-static void diff_patch_update_binary(git_diff_patch *patch)
+static void diff_patch_update_binary(git_patch *patch)
 {
 	if ((patch->delta->flags & DIFF_FLAGS_KNOWN_BINARY) != 0)
 		return;
@@ -74,7 +74,7 @@ static void diff_patch_update_binary(git_diff_patch *patch)
 		patch->delta->flags |= GIT_DIFF_FLAG_NOT_BINARY;
 }
 
-static void diff_patch_init_common(git_diff_patch *patch)
+static void diff_patch_init_common(git_patch *patch)
 {
 	diff_patch_update_binary(patch);
 
@@ -84,11 +84,11 @@ static void diff_patch_init_common(git_diff_patch *patch)
 	patch->flags |= GIT_DIFF_PATCH_INITIALIZED;
 
 	if (patch->diff)
-		git_diff_list_addref(patch->diff);
+		git_diff_addref(patch->diff);
 }
 
 static int diff_patch_init_from_diff(
-	git_diff_patch *patch, git_diff_list *diff, size_t delta_index)
+	git_patch *patch, git_diff *diff, size_t delta_index)
 {
 	int error = 0;
 
@@ -109,12 +109,12 @@ static int diff_patch_init_from_diff(
 }
 
 static int diff_patch_alloc_from_diff(
-	git_diff_patch **out,
-	git_diff_list *diff,
+	git_patch **out,
+	git_diff *diff,
 	size_t delta_index)
 {
 	int error;
-	git_diff_patch *patch = git__calloc(1, sizeof(git_diff_patch));
+	git_patch *patch = git__calloc(1, sizeof(git_patch));
 	GITERR_CHECK_ALLOC(patch);
 
 	if (!(error = diff_patch_init_from_diff(patch, diff, delta_index))) {
@@ -129,7 +129,7 @@ static int diff_patch_alloc_from_diff(
 	return error;
 }
 
-static int diff_patch_load(git_diff_patch *patch, git_diff_output *output)
+static int diff_patch_load(git_patch *patch, git_diff_output *output)
 {
 	int error = 0;
 	bool incomplete_data;
@@ -207,7 +207,7 @@ cleanup:
 }
 
 static int diff_patch_file_callback(
-	git_diff_patch *patch, git_diff_output *output)
+	git_patch *patch, git_diff_output *output)
 {
 	float progress;
 
@@ -223,7 +223,7 @@ static int diff_patch_file_callback(
 	return output->error;
 }
 
-static int diff_patch_generate(git_diff_patch *patch, git_diff_output *output)
+static int diff_patch_generate(git_patch *patch, git_diff_output *output)
 {
 	int error = 0;
 
@@ -248,7 +248,7 @@ static int diff_patch_generate(git_diff_patch *patch, git_diff_output *output)
 	return error;
 }
 
-static void diff_patch_free(git_diff_patch *patch)
+static void diff_patch_free(git_patch *patch)
 {
 	git_diff_file_content__clear(&patch->ofile);
 	git_diff_file_content__clear(&patch->nfile);
@@ -256,7 +256,7 @@ static void diff_patch_free(git_diff_patch *patch)
 	git_array_clear(patch->lines);
 	git_array_clear(patch->hunks);
 
-	git_diff_list_free(patch->diff); /* decrements refcount */
+	git_diff_free(patch->diff); /* decrements refcount */
 	patch->diff = NULL;
 
 	git_pool_clear(&patch->flattened);
@@ -265,7 +265,7 @@ static void diff_patch_free(git_diff_patch *patch)
 		git__free(patch);
 }
 
-static int diff_required(git_diff_list *diff, const char *action)
+static int diff_required(git_diff *diff, const char *action)
 {
 	if (diff)
 		return 0;
@@ -274,16 +274,16 @@ static int diff_required(git_diff_list *diff, const char *action)
 }
 
 int git_diff_foreach(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb data_cb,
+	git_diff_line_cb data_cb,
 	void *payload)
 {
 	int error = 0;
 	git_xdiff_output xo;
 	size_t idx;
-	git_diff_patch patch;
+	git_patch patch;
 
 	if (diff_required(diff, "git_diff_foreach") < 0)
 		return -1;
@@ -305,7 +305,7 @@ int git_diff_foreach(
 			if (!error)
 				error = diff_patch_generate(&patch, &xo.output);
 
-			git_diff_patch_free(&patch);
+			git_patch_free(&patch);
 		}
 
 		if (error < 0)
@@ -318,7 +318,7 @@ int git_diff_foreach(
 }
 
 typedef struct {
-	git_diff_patch patch;
+	git_patch patch;
 	git_diff_delta delta;
 	char paths[GIT_FLEX_ARRAY];
 } diff_patch_with_delta;
@@ -326,7 +326,7 @@ typedef struct {
 static int diff_single_generate(diff_patch_with_delta *pd, git_xdiff_output *xo)
 {
 	int error = 0;
-	git_diff_patch *patch = &pd->patch;
+	git_patch *patch = &pd->patch;
 	bool has_old = ((patch->ofile.flags & GIT_DIFF_FLAG__NO_DATA) == 0);
 	bool has_new = ((patch->nfile.flags & GIT_DIFF_FLAG__NO_DATA) == 0);
 
@@ -430,7 +430,7 @@ int git_diff_blobs(
 	const git_diff_options *opts,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb data_cb,
+	git_diff_line_cb data_cb,
 	void *payload)
 {
 	int error = 0;
@@ -452,13 +452,13 @@ int git_diff_blobs(
 	error = diff_patch_from_blobs(
 		&pd, &xo, old_blob, old_path, new_blob, new_path, opts);
 
-	git_diff_patch_free(&pd.patch);
+	git_patch_free(&pd.patch);
 
 	return error;
 }
 
-int git_diff_patch_from_blobs(
-	git_diff_patch **out,
+int git_patch_from_blobs(
+	git_patch **out,
 	const git_blob *old_blob,
 	const char *old_path,
 	const git_blob *new_blob,
@@ -484,9 +484,9 @@ int git_diff_patch_from_blobs(
 		pd, &xo, old_blob, old_path, new_blob, new_path, opts);
 
 	if (!error)
-		*out = (git_diff_patch *)pd;
+		*out = (git_patch *)pd;
 	else
-		git_diff_patch_free((git_diff_patch *)pd);
+		git_patch_free((git_patch *)pd);
 
 	return error;
 }
@@ -542,7 +542,7 @@ int git_diff_blob_to_buffer(
 	const git_diff_options *opts,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb data_cb,
+	git_diff_line_cb data_cb,
 	void *payload)
 {
 	int error = 0;
@@ -564,13 +564,13 @@ int git_diff_blob_to_buffer(
 	error = diff_patch_from_blob_and_buffer(
 		&pd, &xo, old_blob, old_path, buf, buflen, buf_path, opts);
 
-	git_diff_patch_free(&pd.patch);
+	git_patch_free(&pd.patch);
 
 	return error;
 }
 
-int git_diff_patch_from_blob_and_buffer(
-	git_diff_patch **out,
+int git_patch_from_blob_and_buffer(
+	git_patch **out,
 	const git_blob *old_blob,
 	const char *old_path,
 	const char *buf,
@@ -597,28 +597,28 @@ int git_diff_patch_from_blob_and_buffer(
 		pd, &xo, old_blob, old_path, buf, buflen, buf_path, opts);
 
 	if (!error)
-		*out = (git_diff_patch *)pd;
+		*out = (git_patch *)pd;
 	else
-		git_diff_patch_free((git_diff_patch *)pd);
+		git_patch_free((git_patch *)pd);
 
 	return error;
 }
 
-int git_diff_get_patch(
-	git_diff_patch **patch_ptr,
+int git_patch_from_diff(
+	git_patch **patch_ptr,
 	const git_diff_delta **delta_ptr,
-	git_diff_list *diff,
+	git_diff *diff,
 	size_t idx)
 {
 	int error = 0;
 	git_xdiff_output xo;
 	git_diff_delta *delta = NULL;
-	git_diff_patch *patch = NULL;
+	git_patch *patch = NULL;
 
 	if (patch_ptr) *patch_ptr = NULL;
 	if (delta_ptr) *delta_ptr = NULL;
 
-	if (diff_required(diff, "git_diff_get_patch") < 0)
+	if (diff_required(diff, "git_patch_from_diff") < 0)
 		return -1;
 
 	delta = git_vector_get(&diff->deltas, idx);
@@ -656,7 +656,7 @@ int git_diff_get_patch(
 	}
 
 	if (error || !patch_ptr)
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	else
 		*patch_ptr = patch;
 
@@ -665,29 +665,29 @@ int git_diff_get_patch(
 	return error;
 }
 
-void git_diff_patch_free(git_diff_patch *patch)
+void git_patch_free(git_patch *patch)
 {
 	if (patch)
 		GIT_REFCOUNT_DEC(patch, diff_patch_free);
 }
 
-const git_diff_delta *git_diff_patch_delta(git_diff_patch *patch)
+const git_diff_delta *git_patch_delta(git_patch *patch)
 {
 	assert(patch);
 	return patch->delta;
 }
 
-size_t git_diff_patch_num_hunks(git_diff_patch *patch)
+size_t git_patch_num_hunks(git_patch *patch)
 {
 	assert(patch);
 	return git_array_size(patch->hunks);
 }
 
-int git_diff_patch_line_stats(
+int git_patch_line_stats(
 	size_t *total_ctxt,
 	size_t *total_adds,
 	size_t *total_dels,
-	const git_diff_patch *patch)
+	const git_patch *patch)
 {
 	size_t totals[3], idx;
 
@@ -726,12 +726,12 @@ static int diff_error_outofrange(const char *thing)
 	return GIT_ENOTFOUND;
 }
 
-int git_diff_patch_get_hunk(
-	const git_diff_range **range,
+int git_patch_get_hunk(
+	const git_diff_hunk **out,
 	const char **header,
 	size_t *header_len,
 	size_t *lines_in_hunk,
-	git_diff_patch *patch,
+	git_patch *patch,
 	size_t hunk_idx)
 {
 	diff_patch_hunk *hunk;
@@ -740,21 +740,21 @@ int git_diff_patch_get_hunk(
 	hunk = git_array_get(patch->hunks, hunk_idx);
 
 	if (!hunk) {
-		if (range) *range = NULL;
+		if (out) *out = NULL;
 		if (header) *header = NULL;
 		if (header_len) *header_len = 0;
 		if (lines_in_hunk) *lines_in_hunk = 0;
 		return diff_error_outofrange("hunk");
 	}
 
-	if (range) *range = &hunk->range;
+	if (out) *out = &hunk->hunk;
 	if (header) *header = hunk->header;
 	if (header_len) *header_len = hunk->header_len;
 	if (lines_in_hunk) *lines_in_hunk = hunk->line_count;
 	return 0;
 }
 
-int git_diff_patch_num_lines_in_hunk(git_diff_patch *patch, size_t hunk_idx)
+int git_patch_num_lines_in_hunk(git_patch *patch, size_t hunk_idx)
 {
 	diff_patch_hunk *hunk;
 	assert(patch);
@@ -764,13 +764,13 @@ int git_diff_patch_num_lines_in_hunk(git_diff_patch *patch, size_t hunk_idx)
 	return (int)hunk->line_count;
 }
 
-int git_diff_patch_get_line_in_hunk(
+int git_patch_get_line_in_hunk(
 	char *line_origin,
 	const char **content,
 	size_t *content_len,
 	int *old_lineno,
 	int *new_lineno,
-	git_diff_patch *patch,
+	git_patch *patch,
 	size_t hunk_idx,
 	size_t line_of_hunk)
 {
@@ -810,8 +810,8 @@ notfound:
 	return diff_error_outofrange(thing);
 }
 
-size_t git_diff_patch_size(
-	git_diff_patch *patch,
+size_t git_patch_size(
+	git_patch *patch,
 	int include_context,
 	int include_hunk_headers,
 	int include_file_headers)
@@ -843,36 +843,36 @@ size_t git_diff_patch_size(
 	return out;
 }
 
-git_diff_list *git_diff_patch__diff(git_diff_patch *patch)
+git_diff *git_patch__diff(git_patch *patch)
 {
 	return patch->diff;
 }
 
-git_diff_driver *git_diff_patch__driver(git_diff_patch *patch)
+git_diff_driver *git_patch__driver(git_patch *patch)
 {
 	/* ofile driver is representative for whole patch */
 	return patch->ofile.driver;
 }
 
-void git_diff_patch__old_data(
-	char **ptr, size_t *len, git_diff_patch *patch)
+void git_patch__old_data(
+	char **ptr, size_t *len, git_patch *patch)
 {
 	*ptr = patch->ofile.map.data;
 	*len = patch->ofile.map.len;
 }
 
-void git_diff_patch__new_data(
-	char **ptr, size_t *len, git_diff_patch *patch)
+void git_patch__new_data(
+	char **ptr, size_t *len, git_patch *patch)
 {
 	*ptr = patch->nfile.map.data;
 	*len = patch->nfile.map.len;
 }
 
-int git_diff_patch__invoke_callbacks(
-	git_diff_patch *patch,
+int git_patch__invoke_callbacks(
+	git_patch *patch,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb line_cb,
+	git_diff_line_cb line_cb,
 	void *payload)
 {
 	int error = 0;
@@ -888,7 +888,7 @@ int git_diff_patch__invoke_callbacks(
 		diff_patch_hunk *h = git_array_get(patch->hunks, i);
 
 		error = hunk_cb(
-			patch->delta, &h->range, h->header, h->header_len, payload);
+			patch->delta, &h->hunk, h->header, h->header_len, payload);
 
 		if (!line_cb)
 			continue;
@@ -898,7 +898,7 @@ int git_diff_patch__invoke_callbacks(
 				git_array_get(patch->lines, h->line_start + j);
 
 			error = line_cb(
-				patch->delta, &h->range, l->origin, l->ptr, l->len, payload);
+				patch->delta, &h->hunk, l->origin, l->ptr, l->len, payload);
 		}
 	}
 
@@ -917,12 +917,12 @@ static int diff_patch_file_cb(
 
 static int diff_patch_hunk_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *hunk_,
 	const char *header,
 	size_t header_len,
 	void *payload)
 {
-	git_diff_patch *patch = payload;
+	git_patch *patch = payload;
 	diff_patch_hunk *hunk;
 
 	GIT_UNUSED(delta);
@@ -930,7 +930,7 @@ static int diff_patch_hunk_cb(
 	hunk = git_array_alloc(patch->hunks);
 	GITERR_CHECK_ALLOC(hunk);
 
-	memcpy(&hunk->range, range, sizeof(hunk->range));
+	memcpy(&hunk->hunk, hunk_, sizeof(hunk->hunk));
 
 	assert(header_len + 1 < sizeof(hunk->header));
 	memcpy(&hunk->header, header, header_len);
@@ -942,27 +942,27 @@ static int diff_patch_hunk_cb(
 	hunk->line_start = git_array_size(patch->lines);
 	hunk->line_count = 0;
 
-	patch->oldno = range->old_start;
-	patch->newno = range->new_start;
+	patch->oldno = hunk_->old_start;
+	patch->newno = hunk_->new_start;
 
 	return 0;
 }
 
 static int diff_patch_line_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *hunk_,
 	char line_origin,
 	const char *content,
 	size_t content_len,
 	void *payload)
 {
-	git_diff_patch *patch = payload;
+	git_patch *patch = payload;
 	diff_patch_hunk *hunk;
 	diff_patch_line *line;
 	const char *content_end = content + content_len;
 
 	GIT_UNUSED(delta);
-	GIT_UNUSED(range);
+	GIT_UNUSED(hunk_);
 
 	hunk = git_array_last(patch->hunks);
 	GITERR_CHECK_ALLOC(hunk);
@@ -1023,7 +1023,7 @@ static void diff_output_init(
 	const git_diff_options *opts,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb data_cb,
+	git_diff_line_cb data_cb,
 	void *payload)
 {
 	GIT_UNUSED(opts);
@@ -1036,7 +1036,7 @@ static void diff_output_init(
 	out->payload = payload;
 }
 
-static void diff_output_to_patch(git_diff_output *out, git_diff_patch *patch)
+static void diff_output_to_patch(git_diff_output *out, git_patch *patch)
 {
 	diff_output_init(
 		out, NULL,
diff --git a/src/diff_patch.h b/src/diff_patch.h
index 56af146..df2ba4c 100644
--- a/src/diff_patch.h
+++ b/src/diff_patch.h
@@ -11,19 +11,20 @@
 #include "diff.h"
 #include "diff_file.h"
 #include "array.h"
+#include "git2/patch.h"
 
-extern git_diff_list *git_diff_patch__diff(git_diff_patch *);
+extern git_diff *git_patch__diff(git_patch *);
 
-extern git_diff_driver *git_diff_patch__driver(git_diff_patch *);
+extern git_diff_driver *git_patch__driver(git_patch *);
 
-extern void git_diff_patch__old_data(char **, size_t *, git_diff_patch *);
-extern void git_diff_patch__new_data(char **, size_t *, git_diff_patch *);
+extern void git_patch__old_data(char **, size_t *, git_patch *);
+extern void git_patch__new_data(char **, size_t *, git_patch *);
 
-extern int git_diff_patch__invoke_callbacks(
-	git_diff_patch *patch,
+extern int git_patch__invoke_callbacks(
+	git_patch *patch,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb line_cb,
+	git_diff_line_cb line_cb,
 	void *payload);
 
 typedef struct git_diff_output git_diff_output;
@@ -31,7 +32,7 @@ struct git_diff_output {
 	/* these callbacks are issued with the diff data */
 	git_diff_file_cb file_cb;
 	git_diff_hunk_cb hunk_cb;
-	git_diff_data_cb data_cb;
+	git_diff_line_cb data_cb;
 	void *payload;
 
 	/* this records the actual error in cases where it may be obscured */
@@ -40,7 +41,7 @@ struct git_diff_output {
 	/* this callback is used to do the diff and drive the other callbacks.
 	 * see diff_xdiff.h for how to use this in practice for now.
 	 */
-	int (*diff_cb)(git_diff_output *output, git_diff_patch *patch);
+	int (*diff_cb)(git_diff_output *output, git_patch *patch);
 };
 
 #endif
diff --git a/src/diff_print.c b/src/diff_print.c
index fd18b67..1cf6da2 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -10,8 +10,8 @@
 #include "fileops.h"
 
 typedef struct {
-	git_diff_list *diff;
-	git_diff_data_cb print_cb;
+	git_diff *diff;
+	git_diff_line_cb print_cb;
 	void *payload;
 	git_buf *buf;
 	int oid_strlen;
@@ -19,7 +19,7 @@ typedef struct {
 
 static int diff_print_info_init(
 	diff_print_info *pi,
-	git_buf *out, git_diff_list *diff, git_diff_data_cb cb, void *payload)
+	git_buf *out, git_diff *diff, git_diff_line_cb cb, void *payload)
 {
 	pi->diff     = diff;
 	pi->print_cb = cb;
@@ -119,10 +119,10 @@ static int diff_print_one_compact(
 	return 0;
 }
 
-/* print a git_diff_list to a print callback in compact format */
+/* print a git_diff to a print callback in compact format */
 int git_diff_print_compact(
-	git_diff_list *diff,
-	git_diff_data_cb print_cb,
+	git_diff *diff,
+	git_diff_line_cb print_cb,
 	void *payload)
 {
 	int error;
@@ -180,10 +180,10 @@ static int diff_print_one_raw(
 	return 0;
 }
 
-/* print a git_diff_list to a print callback in raw output format */
+/* print a git_diff to a print callback in raw output format */
 int git_diff_print_raw(
-	git_diff_list *diff,
-	git_diff_data_cb print_cb,
+	git_diff *diff,
+	git_diff_line_cb print_cb,
 	void *payload)
 {
 	int error;
@@ -325,7 +325,7 @@ static int diff_print_patch_file(
 
 static int diff_print_patch_hunk(
 	const git_diff_delta *d,
-	const git_diff_range *r,
+	const git_diff_hunk *r,
 	const char *header,
 	size_t header_len,
 	void *data)
@@ -348,7 +348,7 @@ static int diff_print_patch_hunk(
 
 static int diff_print_patch_line(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char line_origin, /* GIT_DIFF_LINE value from above */
 	const char *content,
 	size_t content_len,
@@ -379,10 +379,10 @@ static int diff_print_patch_line(
 	return 0;
 }
 
-/* print a git_diff_list to an output callback in patch format */
+/* print a git_diff to an output callback in patch format */
 int git_diff_print_patch(
-	git_diff_list *diff,
-	git_diff_data_cb print_cb,
+	git_diff *diff,
+	git_diff_line_cb print_cb,
 	void *payload)
 {
 	int error;
@@ -399,10 +399,10 @@ int git_diff_print_patch(
 	return error;
 }
 
-/* print a git_diff_patch to an output callback */
-int git_diff_patch_print(
-	git_diff_patch *patch,
-	git_diff_data_cb print_cb,
+/* print a git_patch to an output callback */
+int git_patch_print(
+	git_patch *patch,
+	git_diff_line_cb print_cb,
 	void *payload)
 {
 	int error;
@@ -412,8 +412,8 @@ int git_diff_patch_print(
 	assert(patch && print_cb);
 
 	if (!(error = diff_print_info_init(
-			&pi, &temp, git_diff_patch__diff(patch), print_cb, payload)))
-		error = git_diff_patch__invoke_callbacks(
+			&pi, &temp, git_patch__diff(patch), print_cb, payload)))
+		error = git_patch__invoke_callbacks(
 			patch, diff_print_patch_file, diff_print_patch_hunk,
 			diff_print_patch_line, &pi);
 
@@ -424,7 +424,7 @@ int git_diff_patch_print(
 
 static int diff_print_to_buffer_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char line_origin,
 	const char *content,
 	size_t content_len,
@@ -435,15 +435,15 @@ static int diff_print_to_buffer_cb(
 	return git_buf_put(output, content, content_len);
 }
 
-/* print a git_diff_patch to a string buffer */
-int git_diff_patch_to_str(
+/* print a git_patch to a string buffer */
+int git_patch_to_str(
 	char **string,
-	git_diff_patch *patch)
+	git_patch *patch)
 {
 	int error;
 	git_buf output = GIT_BUF_INIT;
 
-	error = git_diff_patch_print(patch, diff_print_to_buffer_cb, &output);
+	error = git_patch_print(patch, diff_print_to_buffer_cb, &output);
 
 	/* GIT_EUSER means git_buf_put in print_to_buffer_cb returned -1,
 	 * meaning a memory allocation failure, so just map to -1...
diff --git a/src/diff_tform.c b/src/diff_tform.c
index cbe8baf..c0a6067 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -97,8 +97,8 @@ static git_diff_delta *diff_delta__merge_like_cgit(
 }
 
 int git_diff_merge(
-	git_diff_list *onto,
-	const git_diff_list *from)
+	git_diff *onto,
+	const git_diff *from)
 {
 	int error = 0;
 	git_pool onto_pool;
@@ -230,7 +230,7 @@ int git_diff_find_similar__calc_similarity(
 #define DEFAULT_RENAME_LIMIT 200
 
 static int normalize_find_opts(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_diff_find_options *opts,
 	git_diff_find_options *given)
 {
@@ -328,7 +328,7 @@ static int normalize_find_opts(
 }
 
 static int apply_splits_and_deletes(
-	git_diff_list *diff, size_t expected_size, bool actually_split)
+	git_diff *diff, size_t expected_size, bool actually_split)
 {
 	git_vector onto = GIT_VECTOR_INIT;
 	size_t i;
@@ -402,7 +402,7 @@ on_error:
 	return -1;
 }
 
-GIT_INLINE(git_diff_file *) similarity_get_file(git_diff_list *diff, size_t idx)
+GIT_INLINE(git_diff_file *) similarity_get_file(git_diff *diff, size_t idx)
 {
 	git_diff_delta *delta = git_vector_get(&diff->deltas, idx / 2);
 	return (idx & 1) ? &delta->new_file : &delta->old_file;
@@ -419,7 +419,7 @@ typedef struct {
 } similarity_info;
 
 static int similarity_init(
-	similarity_info *info, git_diff_list *diff, size_t file_idx)
+	similarity_info *info, git_diff *diff, size_t file_idx)
 {
 	info->idx  = file_idx;
 	info->src  = (file_idx & 1) ? diff->new_src : diff->old_src;
@@ -509,7 +509,7 @@ static void similarity_unload(similarity_info *info)
  */
 static int similarity_measure(
 	int *score,
-	git_diff_list *diff,
+	git_diff *diff,
 	const git_diff_find_options *opts,
 	void **cache,
 	size_t a_idx,
@@ -595,7 +595,7 @@ cleanup:
 }
 
 static int calc_self_similarity(
-	git_diff_list *diff,
+	git_diff *diff,
 	const git_diff_find_options *opts,
 	size_t delta_idx,
 	void **cache)
@@ -620,7 +620,7 @@ static int calc_self_similarity(
 }
 
 static bool is_rename_target(
-	git_diff_list *diff,
+	git_diff *diff,
 	const git_diff_find_options *opts,
 	size_t delta_idx,
 	void **cache)
@@ -675,7 +675,7 @@ static bool is_rename_target(
 }
 
 static bool is_rename_source(
-	git_diff_list *diff,
+	git_diff *diff,
 	const git_diff_find_options *opts,
 	size_t delta_idx,
 	void **cache)
@@ -759,7 +759,7 @@ typedef struct {
 } diff_find_match;
 
 int git_diff_find_similar(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_diff_find_options *given_opts)
 {
 	size_t s, t;
diff --git a/src/diff_xdiff.c b/src/diff_xdiff.c
index 7694fb9..e3aa8f3 100644
--- a/src/diff_xdiff.c
+++ b/src/diff_xdiff.c
@@ -24,26 +24,26 @@ static int git_xdiff_scan_int(const char **str, int *value)
 	return (digits > 0) ? 0 : -1;
 }
 
-static int git_xdiff_parse_hunk(git_diff_range *range, const char *header)
+static int git_xdiff_parse_hunk(git_diff_hunk *hunk, const char *header)
 {
 	/* expect something of the form "@@ -%d[,%d] +%d[,%d] @@" */
 	if (*header != '@')
 		return -1;
-	if (git_xdiff_scan_int(&header, &range->old_start) < 0)
+	if (git_xdiff_scan_int(&header, &hunk->old_start) < 0)
 		return -1;
 	if (*header == ',') {
-		if (git_xdiff_scan_int(&header, &range->old_lines) < 0)
+		if (git_xdiff_scan_int(&header, &hunk->old_lines) < 0)
 			return -1;
 	} else
-		range->old_lines = 1;
-	if (git_xdiff_scan_int(&header, &range->new_start) < 0)
+		hunk->old_lines = 1;
+	if (git_xdiff_scan_int(&header, &hunk->new_start) < 0)
 		return -1;
 	if (*header == ',') {
-		if (git_xdiff_scan_int(&header, &range->new_lines) < 0)
+		if (git_xdiff_scan_int(&header, &hunk->new_lines) < 0)
 			return -1;
 	} else
-		range->new_lines = 1;
-	if (range->old_start < 0 || range->new_start < 0)
+		hunk->new_lines = 1;
+	if (hunk->old_start < 0 || hunk->new_start < 0)
 		return -1;
 
 	return 0;
@@ -51,24 +51,24 @@ static int git_xdiff_parse_hunk(git_diff_range *range, const char *header)
 
 typedef struct {
 	git_xdiff_output *xo;
-	git_diff_patch *patch;
-	git_diff_range range;
+	git_patch *patch;
+	git_diff_hunk hunk;
 } git_xdiff_info;
 
 static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
 {
 	git_xdiff_info *info = priv;
-	git_diff_patch *patch = info->patch;
-	const git_diff_delta *delta = git_diff_patch_delta(patch);
+	git_patch *patch = info->patch;
+	const git_diff_delta *delta = git_patch_delta(patch);
 	git_diff_output *output = &info->xo->output;
 
 	if (len == 1) {
-		output->error = git_xdiff_parse_hunk(&info->range, bufs[0].ptr);
+		output->error = git_xdiff_parse_hunk(&info->hunk, bufs[0].ptr);
 		if (output->error < 0)
 			return output->error;
 
 		if (output->hunk_cb != NULL &&
-			output->hunk_cb(delta, &info->range,
+			output->hunk_cb(delta, &info->hunk,
 				bufs[0].ptr, bufs[0].size, output->payload))
 			output->error = GIT_EUSER;
 	}
@@ -81,7 +81,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
 			GIT_DIFF_LINE_CONTEXT;
 
 		if (output->data_cb != NULL &&
-			output->data_cb(delta, &info->range,
+			output->data_cb(delta, &info->hunk,
 				origin, bufs[1].ptr, bufs[1].size, output->payload))
 			output->error = GIT_EUSER;
 	}
@@ -98,7 +98,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
 			GIT_DIFF_LINE_CONTEXT_EOFNL;
 
 		if (output->data_cb != NULL &&
-			output->data_cb(delta, &info->range,
+			output->data_cb(delta, &info->hunk,
 				origin, bufs[2].ptr, bufs[2].size, output->payload))
 			output->error = GIT_EUSER;
 	}
@@ -106,7 +106,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
 	return output->error;
 }
 
-static int git_xdiff(git_diff_output *output, git_diff_patch *patch)
+static int git_xdiff(git_diff_output *output, git_patch *patch)
 {
 	git_xdiff_output *xo = (git_xdiff_output *)output;
 	git_xdiff_info info;
@@ -120,7 +120,7 @@ static int git_xdiff(git_diff_output *output, git_diff_patch *patch)
 	xo->callback.priv = &info;
 
 	git_diff_find_context_init(
-		&xo->config.find_func, &findctxt, git_diff_patch__driver(patch));
+		&xo->config.find_func, &findctxt, git_patch__driver(patch));
 	xo->config.find_func_priv = &findctxt;
 
 	if (xo->config.find_func != NULL)
@@ -132,8 +132,8 @@ static int git_xdiff(git_diff_output *output, git_diff_patch *patch)
 	 * updates are needed to xo->params.flags
 	 */
 
-	git_diff_patch__old_data(&xd_old_data.ptr, &xd_old_data.size, patch);
-	git_diff_patch__new_data(&xd_new_data.ptr, &xd_new_data.size, patch);
+	git_patch__old_data(&xd_old_data.ptr, &xd_old_data.size, patch);
+	git_patch__new_data(&xd_new_data.ptr, &xd_new_data.size, patch);
 
 	xdl_diff(&xd_old_data, &xd_new_data,
 		&xo->params, &xo->config, &xo->callback);
diff --git a/src/pathspec.c b/src/pathspec.c
index d56d039..1e7e65e 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -585,7 +585,7 @@ int git_pathspec_match_tree(
 
 int git_pathspec_match_diff(
 	git_pathspec_match_list **out,
-	git_diff_list *diff,
+	git_diff *diff,
 	uint32_t flags,
 	git_pathspec *ps)
 {
diff --git a/src/reset.c b/src/reset.c
index cea212a..3fd4b91 100644
--- a/src/reset.c
+++ b/src/reset.c
@@ -24,7 +24,7 @@ int git_reset_default(
 {
 	git_object *commit = NULL;
 	git_tree *tree = NULL;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	size_t i;
 	git_diff_delta *delta;
@@ -85,7 +85,7 @@ cleanup:
 	git_object_free(commit);
 	git_tree_free(tree);
 	git_index_free(index);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	return error;
 }
diff --git a/src/stash.c b/src/stash.c
index 7742eee..6cf26f7 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -221,7 +221,7 @@ static int build_untracked_tree(
 	uint32_t flags)
 {
 	git_tree *i_tree = NULL;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	struct cb_data data = {0};
 	int error;
@@ -259,7 +259,7 @@ static int build_untracked_tree(
 	error = build_tree_from_index(tree_out, index);
 
 cleanup:
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(i_tree);
 	return error;
 }
@@ -311,7 +311,7 @@ static int build_workdir_tree(
 {
 	git_repository *repo = git_index_owner(index);
 	git_tree *b_tree = NULL;
-	git_diff_list *diff = NULL, *diff2 = NULL;
+	git_diff *diff = NULL, *diff2 = NULL;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	struct cb_data data = {0};
 	int error;
@@ -346,8 +346,8 @@ static int build_workdir_tree(
 		goto cleanup;
 
 cleanup:
-	git_diff_list_free(diff);
-	git_diff_list_free(diff2);
+	git_diff_free(diff);
+	git_diff_free(diff2);
 	git_tree_free(b_tree);
 
 	return error;
diff --git a/src/status.c b/src/status.c
index be40b9f..2b84794 100644
--- a/src/status.c
+++ b/src/status.c
@@ -52,7 +52,7 @@ static unsigned int index_delta2status(const git_diff_delta *head2idx)
 }
 
 static unsigned int workdir_delta2status(
-	git_diff_list *diff, git_diff_delta *idx2wd)
+	git_diff *diff, git_diff_delta *idx2wd)
 {
 	git_status_t st = GIT_STATUS_CURRENT;
 
@@ -361,8 +361,8 @@ void git_status_list_free(git_status_list *status)
 	if (status == NULL)
 		return;
 
-	git_diff_list_free(status->head2idx);
-	git_diff_list_free(status->idx2wd);
+	git_diff_free(status->head2idx);
+	git_diff_free(status->idx2wd);
 
 	git_vector_foreach(&status->paired, i, status_entry)
 		git__free(status_entry);
diff --git a/src/status.h b/src/status.h
index b58e0eb..33008b8 100644
--- a/src/status.h
+++ b/src/status.h
@@ -14,8 +14,8 @@
 struct git_status_list {
 	git_status_options opts;
 
-	git_diff_list *head2idx;
-	git_diff_list *idx2wd;
+	git_diff *head2idx;
+	git_diff *idx2wd;
 
 	git_vector paired;
 };
diff --git a/src/submodule.c b/src/submodule.c
index 12ade83..18d80f0 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1528,7 +1528,7 @@ static void submodule_get_wd_status(
 		(sm->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID) ? &sm->wd_oid : NULL;
 	git_tree *sm_head = NULL;
 	git_diff_options opt = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff;
+	git_diff *diff;
 
 	*status = *status & ~GIT_SUBMODULE_STATUS__WD_FLAGS;
 
@@ -1568,7 +1568,7 @@ static void submodule_get_wd_status(
 		else {
 			if (git_diff_num_deltas(diff) > 0)
 				*status |= GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED;
-			git_diff_list_free(diff);
+			git_diff_free(diff);
 			diff = NULL;
 		}
 
@@ -1588,7 +1588,7 @@ static void submodule_get_wd_status(
 		if (git_diff_num_deltas(diff) != untracked)
 			*status |= GIT_SUBMODULE_STATUS_WD_WD_MODIFIED;
 
-		git_diff_list_free(diff);
+		git_diff_free(diff);
 		diff = NULL;
 	}
 }
diff --git a/tests-clar/diff/blob.c b/tests-clar/diff/blob.c
index 42b9fcd..bed0da0 100644
--- a/tests-clar/diff/blob.c
+++ b/tests-clar/diff/blob.c
@@ -142,7 +142,7 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
 {
 	git_blob *a, *b, *c;
 	git_oid a_oid, b_oid, c_oid;
-	git_diff_patch *p;
+	git_patch *p;
 	const git_diff_delta *delta;
 	size_t tc, ta, td;
 
@@ -161,11 +161,11 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
 	/* Doing the equivalent of a `git diff -U1` on these files */
 
 	/* diff on tests/resources/attr/root_test1 */
-	cl_git_pass(git_diff_patch_from_blobs(&p, a, NULL, b, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, a, NULL, b, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
 	cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.oid));
@@ -173,22 +173,22 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
 	cl_assert(git_oid_equal(git_blob_id(b), &delta->new_file.oid));
 	cl_assert_equal_sz(git_blob_rawsize(b), delta->new_file.size);
 
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(6, git_diff_patch_num_lines_in_hunk(p, 0));
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(6, git_patch_num_lines_in_hunk(p, 0));
 
-	cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+	cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
 	cl_assert_equal_i(1, (int)tc);
 	cl_assert_equal_i(5, (int)ta);
 	cl_assert_equal_i(0, (int)td);
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	/* diff on tests/resources/attr/root_test2 */
-	cl_git_pass(git_diff_patch_from_blobs(&p, b, NULL, c, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, b, NULL, c, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
 	cl_assert(git_oid_equal(git_blob_id(b), &delta->old_file.oid));
@@ -196,22 +196,22 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
 	cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.oid));
 	cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
 
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(15, git_diff_patch_num_lines_in_hunk(p, 0));
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(15, git_patch_num_lines_in_hunk(p, 0));
 
-	cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+	cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
 	cl_assert_equal_i(3, (int)tc);
 	cl_assert_equal_i(9, (int)ta);
 	cl_assert_equal_i(3, (int)td);
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	/* diff on tests/resources/attr/root_test3 */
-	cl_git_pass(git_diff_patch_from_blobs(&p, a, NULL, c, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, a, NULL, c, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
 	cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.oid));
@@ -219,19 +219,19 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
 	cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.oid));
 	cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
 
-	cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+	cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
 	cl_assert_equal_i(0, (int)tc);
 	cl_assert_equal_i(12, (int)ta);
 	cl_assert_equal_i(1, (int)td);
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	/* one more */
-	cl_git_pass(git_diff_patch_from_blobs(&p, c, NULL, d, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, c, NULL, d, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
 	cl_assert(git_oid_equal(git_blob_id(c), &delta->old_file.oid));
@@ -239,16 +239,16 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
 	cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
 	cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
 
-	cl_assert_equal_i(2, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(5, git_diff_patch_num_lines_in_hunk(p, 0));
-	cl_assert_equal_i(9, git_diff_patch_num_lines_in_hunk(p, 1));
+	cl_assert_equal_i(2, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(5, git_patch_num_lines_in_hunk(p, 0));
+	cl_assert_equal_i(9, git_patch_num_lines_in_hunk(p, 1));
 
-	cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+	cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
 	cl_assert_equal_i(4, (int)tc);
 	cl_assert_equal_i(6, (int)ta);
 	cl_assert_equal_i(4, (int)td);
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	git_blob_free(a);
 	git_blob_free(b);
@@ -317,16 +317,16 @@ void test_diff_blob__can_compare_against_null_blobs(void)
 void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
 {
 	git_blob *e = NULL;
-	git_diff_patch *p;
+	git_patch *p;
 	const git_diff_delta *delta;
 	int line;
 	char origin;
 
-	cl_git_pass(git_diff_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
 	cl_assert(git_oid_equal(git_blob_id(d), &delta->old_file.oid));
@@ -334,24 +334,24 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
 	cl_assert(git_oid_iszero(&delta->new_file.oid));
 	cl_assert_equal_sz(0, delta->new_file.size);
 
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(14, git_diff_patch_num_lines_in_hunk(p, 0));
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(14, git_patch_num_lines_in_hunk(p, 0));
 
-	for (line = 0; line < git_diff_patch_num_lines_in_hunk(p, 0); ++line) {
-		cl_git_pass(git_diff_patch_get_line_in_hunk(
+	for (line = 0; line < git_patch_num_lines_in_hunk(p, 0); ++line) {
+		cl_git_pass(git_patch_get_line_in_hunk(
 			&origin, NULL, NULL, NULL, NULL, p, 0, line));
 		cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
 	}
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	opts.flags |= GIT_DIFF_REVERSE;
 
-	cl_git_pass(git_diff_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
 	cl_assert(git_oid_iszero(&delta->old_file.oid));
@@ -359,44 +359,44 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
 	cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
 	cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
 
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(14, git_diff_patch_num_lines_in_hunk(p, 0));
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(14, git_patch_num_lines_in_hunk(p, 0));
 
-	for (line = 0; line < git_diff_patch_num_lines_in_hunk(p, 0); ++line) {
-		cl_git_pass(git_diff_patch_get_line_in_hunk(
+	for (line = 0; line < git_patch_num_lines_in_hunk(p, 0); ++line) {
+		cl_git_pass(git_patch_get_line_in_hunk(
 			&origin, NULL, NULL, NULL, NULL, p, 0, line));
 		cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
 	}
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	opts.flags ^= GIT_DIFF_REVERSE;
 
-	cl_git_pass(git_diff_patch_from_blobs(&p, alien, NULL, NULL, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, alien, NULL, NULL, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
 	cl_assert((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
 
-	cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
+	cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blobs(&p, NULL, NULL, alien, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, NULL, NULL, alien, NULL, &opts));
 
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
 	cl_assert((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
 
-	cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
+	cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 }
 
 static void assert_identical_blobs_comparison(diff_expects *expected)
@@ -437,13 +437,13 @@ void test_diff_blob__can_compare_identical_blobs(void)
 
 void test_diff_blob__can_compare_identical_blobs_with_patch(void)
 {
-	git_diff_patch *p;
+	git_patch *p;
 	const git_diff_delta *delta;
 
-	cl_git_pass(git_diff_patch_from_blobs(&p, d, NULL, d, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, d, NULL, d, NULL, &opts));
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
 	cl_assert_equal_sz(delta->old_file.size, git_blob_rawsize(d));
@@ -451,13 +451,13 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
 	cl_assert_equal_sz(delta->new_file.size, git_blob_rawsize(d));
 	cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
 
-	cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
-	git_diff_patch_free(p);
+	cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blobs(&p, NULL, NULL, NULL, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, NULL, NULL, NULL, NULL, &opts));
 	cl_assert(p != NULL);
 
-	delta = git_diff_patch_delta(p);
+	delta = git_patch_delta(p);
 	cl_assert(delta != NULL);
 	cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
 	cl_assert_equal_sz(0, delta->old_file.size);
@@ -465,14 +465,14 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
 	cl_assert_equal_sz(0, delta->new_file.size);
 	cl_assert(git_oid_iszero(&delta->new_file.oid));
 
-	cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
-	git_diff_patch_free(p);
+	cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blobs(&p, alien, NULL, alien, NULL, &opts));
+	cl_git_pass(git_patch_from_blobs(&p, alien, NULL, alien, NULL, &opts));
 	cl_assert(p != NULL);
-	cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_diff_patch_delta(p)->status);
-	cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
-	git_diff_patch_free(p);
+	cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_patch_delta(p)->status);
+	cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+	git_patch_free(p);
 }
 
 static void assert_binary_blobs_comparison(diff_expects *expected)
@@ -693,7 +693,7 @@ void test_diff_blob__can_compare_blob_to_buffer(void)
 
 void test_diff_blob__can_compare_blob_to_buffer_with_patch(void)
 {
-	git_diff_patch *p;
+	git_patch *p;
 	git_blob *a;
 	git_oid a_oid;
 	const char *a_content = "Hello from the root\n";
@@ -705,58 +705,58 @@ void test_diff_blob__can_compare_blob_to_buffer_with_patch(void)
 	cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
 
 	/* diff from blob a to content of b */
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, a, NULL, b_content, strlen(b_content), NULL, &opts));
 
 	cl_assert(p != NULL);
-	cl_assert_equal_i(GIT_DELTA_MODIFIED, git_diff_patch_delta(p)->status);
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(6, git_diff_patch_num_lines_in_hunk(p, 0));
+	cl_assert_equal_i(GIT_DELTA_MODIFIED, git_patch_delta(p)->status);
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(6, git_patch_num_lines_in_hunk(p, 0));
 
-	cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+	cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
 	cl_assert_equal_i(1, (int)tc);
 	cl_assert_equal_i(5, (int)ta);
 	cl_assert_equal_i(0, (int)td);
 
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	/* diff from blob a to content of a */
 	opts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, a, NULL, a_content, strlen(a_content), NULL, &opts));
 	cl_assert(p != NULL);
-	cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_diff_patch_delta(p)->status);
-	cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
-	git_diff_patch_free(p);
+	cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_patch_delta(p)->status);
+	cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+	git_patch_free(p);
 
 	/* diff from NULL blob to content of a */
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, NULL, NULL, a_content, strlen(a_content), NULL, &opts));
 	cl_assert(p != NULL);
-	cl_assert_equal_i(GIT_DELTA_ADDED, git_diff_patch_delta(p)->status);
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(1, git_diff_patch_num_lines_in_hunk(p, 0));
-	git_diff_patch_free(p);
+	cl_assert_equal_i(GIT_DELTA_ADDED, git_patch_delta(p)->status);
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(1, git_patch_num_lines_in_hunk(p, 0));
+	git_patch_free(p);
 
 	/* diff from blob a to NULL buffer */
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, a, NULL, NULL, 0, NULL, &opts));
 	cl_assert(p != NULL);
-	cl_assert_equal_i(GIT_DELTA_DELETED, git_diff_patch_delta(p)->status);
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(1, git_diff_patch_num_lines_in_hunk(p, 0));
-	git_diff_patch_free(p);
+	cl_assert_equal_i(GIT_DELTA_DELETED, git_patch_delta(p)->status);
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(1, git_patch_num_lines_in_hunk(p, 0));
+	git_patch_free(p);
 
 	/* diff with reverse */
 	opts.flags ^= GIT_DIFF_REVERSE;
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, a, NULL, NULL, 0, NULL, &opts));
 	cl_assert(p != NULL);
-	cl_assert_equal_i(GIT_DELTA_ADDED, git_diff_patch_delta(p)->status);
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
-	cl_assert_equal_i(1, git_diff_patch_num_lines_in_hunk(p, 0));
-	git_diff_patch_free(p);
+	cl_assert_equal_i(GIT_DELTA_ADDED, git_patch_delta(p)->status);
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+	cl_assert_equal_i(1, git_patch_num_lines_in_hunk(p, 0));
+	git_patch_free(p);
 
 	git_blob_free(a);
 }
@@ -853,7 +853,7 @@ void test_diff_blob__using_path_and_attributes(void)
 		"0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\x00\n0123456789\n";
 	size_t bin_len = 33;
 	const char *changed;
-	git_diff_patch *p;
+	git_patch *p;
 	char *pout;
 
 	/* set up custom diff drivers and 'diff' attribute mappings for them */
@@ -950,9 +950,9 @@ void test_diff_blob__using_path_and_attributes(void)
 	cl_assert_equal_i(3, expected.line_adds);
 	cl_assert_equal_i(0, expected.line_dels);
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, nonbin, "zzz.normal", changed, strlen(changed), NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.normal b/zzz.normal\n"
 		"index 45141a7..75b0dbb 100644\n"
@@ -963,21 +963,21 @@ void test_diff_blob__using_path_and_attributes(void)
 		"+And more\n"
 		"+Go here\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, nonbin, "zzz.binary", changed, strlen(changed), NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.binary b/zzz.binary\n"
 		"index 45141a7..75b0dbb 100644\n"
 		"Binary files a/zzz.binary and b/zzz.binary differ\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, nonbin, "zzz.alphary", changed, strlen(changed), NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.alphary b/zzz.alphary\n"
 		"index 45141a7..75b0dbb 100644\n"
@@ -988,11 +988,11 @@ void test_diff_blob__using_path_and_attributes(void)
 		"+And more\n"
 		"+Go here\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, nonbin, "zzz.numary", changed, strlen(changed), NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.numary b/zzz.numary\n"
 		"index 45141a7..75b0dbb 100644\n"
@@ -1003,7 +1003,7 @@ void test_diff_blob__using_path_and_attributes(void)
 		"+And more\n"
 		"+Go here\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	/* "0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\x00\n0123456789\n"
 	 * 33 bytes
@@ -1011,19 +1011,19 @@ void test_diff_blob__using_path_and_attributes(void)
 
 	changed = "0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\x00\nreplace a line\n";
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, bin, "zzz.normal", changed, 37, NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.normal b/zzz.normal\n"
 		"index b435cd5..1604519 100644\n"
 		"Binary files a/zzz.normal and b/zzz.normal differ\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, bin, "zzz.textary", changed, 37, NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.textary b/zzz.textary\n"
 		"index b435cd5..1604519 100644\n"
@@ -1033,11 +1033,11 @@ void test_diff_blob__using_path_and_attributes(void)
 		"-0123456789\n"
 		"+replace a line\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, bin, "zzz.textalphary", changed, 37, NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.textalphary b/zzz.textalphary\n"
 		"index b435cd5..1604519 100644\n"
@@ -1047,11 +1047,11 @@ void test_diff_blob__using_path_and_attributes(void)
 		"-0123456789\n"
 		"+replace a line\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
-	cl_git_pass(git_diff_patch_from_blob_and_buffer(
+	cl_git_pass(git_patch_from_blob_and_buffer(
 		&p, bin, "zzz.textnumary", changed, 37, NULL, &opts));
-	cl_git_pass(git_diff_patch_to_str(&pout, p));
+	cl_git_pass(git_patch_to_str(&pout, p));
 	cl_assert_equal_s(
 		"diff --git a/zzz.textnumary b/zzz.textnumary\n"
 		"index b435cd5..1604519 100644\n"
@@ -1061,7 +1061,7 @@ void test_diff_blob__using_path_and_attributes(void)
 		"-0123456789\n"
 		"+replace a line\n", pout);
 	git__free(pout);
-	git_diff_patch_free(p);
+	git_patch_free(p);
 
 	git_blob_free(nonbin);
 	git_blob_free(bin);
diff --git a/tests-clar/diff/diff_helpers.c b/tests-clar/diff/diff_helpers.c
index 3452f23..34ef1df 100644
--- a/tests-clar/diff/diff_helpers.c
+++ b/tests-clar/diff/diff_helpers.c
@@ -95,7 +95,7 @@ int diff_print_file_cb(
 
 int diff_hunk_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	const char *header,
 	size_t header_len,
 	void *payload)
@@ -115,7 +115,7 @@ int diff_hunk_cb(
 
 int diff_line_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char line_origin,
 	const char *content,
 	size_t content_len,
@@ -149,25 +149,25 @@ int diff_line_cb(
 }
 
 int diff_foreach_via_iterator(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb line_cb,
+	git_diff_line_cb line_cb,
 	void *data)
 {
 	size_t d, num_d = git_diff_num_deltas(diff);
 
 	for (d = 0; d < num_d; ++d) {
-		git_diff_patch *patch;
+		git_patch *patch;
 		const git_diff_delta *delta;
 		size_t h, num_h;
 
-		cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
 		cl_assert(delta);
 
 		/* call file_cb for this file */
 		if (file_cb != NULL && file_cb(delta, (float)d / num_d, data) != 0) {
-			git_diff_patch_free(patch);
+			git_patch_free(patch);
 			goto abort;
 		}
 
@@ -179,22 +179,22 @@ int diff_foreach_via_iterator(
 		}
 
 		if (!hunk_cb && !line_cb) {
-			git_diff_patch_free(patch);
+			git_patch_free(patch);
 			continue;
 		}
 
-		num_h = git_diff_patch_num_hunks(patch);
+		num_h = git_patch_num_hunks(patch);
 
 		for (h = 0; h < num_h; h++) {
-			const git_diff_range *range;
+			const git_diff_hunk *range;
 			const char *hdr;
 			size_t hdr_len, l, num_l;
 
-			cl_git_pass(git_diff_patch_get_hunk(
+			cl_git_pass(git_patch_get_hunk(
 				&range, &hdr, &hdr_len, &num_l, patch, h));
 
 			if (hunk_cb && hunk_cb(delta, range, hdr, hdr_len, data) != 0) {
-				git_diff_patch_free(patch);
+				git_patch_free(patch);
 				goto abort;
 			}
 
@@ -204,19 +204,19 @@ int diff_foreach_via_iterator(
 				size_t line_len;
 				int old_lineno, new_lineno;
 
-				cl_git_pass(git_diff_patch_get_line_in_hunk(
+				cl_git_pass(git_patch_get_line_in_hunk(
 					&origin, &line, &line_len, &old_lineno, &new_lineno,
 					patch, h, l));
 
 				if (line_cb &&
 					line_cb(delta, range, origin, line, line_len, data) != 0) {
-					git_diff_patch_free(patch);
+					git_patch_free(patch);
 					goto abort;
 				}
 			}
 		}
 
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	}
 
 	return 0;
@@ -228,7 +228,7 @@ abort:
 
 static int diff_print_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char line_origin, /**< GIT_DIFF_LINE_... value from above */
 	const char *content,
 	size_t content_len,
@@ -243,12 +243,12 @@ static int diff_print_cb(
 	return 0;
 }
 
-void diff_print(FILE *fp, git_diff_list *diff)
+void diff_print(FILE *fp, git_diff *diff)
 {
 	cl_git_pass(git_diff_print_patch(diff, diff_print_cb, fp ? fp : stderr));
 }
 
-void diff_print_raw(FILE *fp, git_diff_list *diff)
+void diff_print_raw(FILE *fp, git_diff *diff)
 {
 	cl_git_pass(git_diff_print_raw(diff, diff_print_cb, fp ? fp : stderr));
 }
diff --git a/tests-clar/diff/diff_helpers.h b/tests-clar/diff/diff_helpers.h
index bb76d00..e3ad61f 100644
--- a/tests-clar/diff/diff_helpers.h
+++ b/tests-clar/diff/diff_helpers.h
@@ -44,25 +44,25 @@ extern int diff_print_file_cb(
 
 extern int diff_hunk_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	const char *header,
 	size_t header_len,
 	void *cb_data);
 
 extern int diff_line_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char line_origin,
 	const char *content,
 	size_t content_len,
 	void *cb_data);
 
 extern int diff_foreach_via_iterator(
-	git_diff_list *diff,
+	git_diff *diff,
 	git_diff_file_cb file_cb,
 	git_diff_hunk_cb hunk_cb,
-	git_diff_data_cb line_cb,
+	git_diff_line_cb line_cb,
 	void *data);
 
-extern void diff_print(FILE *fp, git_diff_list *diff);
-extern void diff_print_raw(FILE *fp, git_diff_list *diff);
+extern void diff_print(FILE *fp, git_diff *diff);
+extern void diff_print_raw(FILE *fp, git_diff *diff);
diff --git a/tests-clar/diff/diffiter.c b/tests-clar/diff/diffiter.c
index ea59084..48b56e2 100644
--- a/tests-clar/diff/diffiter.c
+++ b/tests-clar/diff/diffiter.c
@@ -13,7 +13,7 @@ void test_diff_diffiter__cleanup(void)
 void test_diff_diffiter__create(void)
 {
 	git_repository *repo = cl_git_sandbox_init("attr");
-	git_diff_list *diff;
+	git_diff *diff;
 	size_t d, num_d;
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, repo, NULL, NULL));
@@ -21,16 +21,16 @@ void test_diff_diffiter__create(void)
 	num_d = git_diff_num_deltas(diff);
 	for (d = 0; d < num_d; ++d) {
 		const git_diff_delta *delta;
-		cl_git_pass(git_diff_get_patch(NULL, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(NULL, &delta, diff, d));
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_diffiter__iterate_files_1(void)
 {
 	git_repository *repo = cl_git_sandbox_init("attr");
-	git_diff_list *diff;
+	git_diff *diff;
 	size_t d, num_d;
 	diff_expects exp = { 0 };
 
@@ -40,20 +40,20 @@ void test_diff_diffiter__iterate_files_1(void)
 
 	for (d = 0; d < num_d; ++d) {
 		const git_diff_delta *delta;
-		cl_git_pass(git_diff_get_patch(NULL, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(NULL, &delta, diff, d));
 		cl_assert(delta != NULL);
 
 		diff_file_cb(delta, (float)d / (float)num_d, &exp);
 	}
 	cl_assert_equal_sz(6, exp.files);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_diffiter__iterate_files_2(void)
 {
 	git_repository *repo = cl_git_sandbox_init("status");
-	git_diff_list *diff;
+	git_diff *diff;
 	size_t d, num_d;
 	int count = 0;
 
@@ -64,20 +64,20 @@ void test_diff_diffiter__iterate_files_2(void)
 
 	for (d = 0; d < num_d; ++d) {
 		const git_diff_delta *delta;
-		cl_git_pass(git_diff_get_patch(NULL, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(NULL, &delta, diff, d));
 		cl_assert(delta != NULL);
 		count++;
 	}
 	cl_assert_equal_i(8, count);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_diffiter__iterate_files_and_hunks(void)
 {
 	git_repository *repo = cl_git_sandbox_init("status");
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	size_t d, num_d;
 	int file_count = 0, hunk_count = 0;
 
@@ -90,25 +90,25 @@ void test_diff_diffiter__iterate_files_and_hunks(void)
 	num_d = git_diff_num_deltas(diff);
 
 	for (d = 0; d < num_d; ++d) {
-		git_diff_patch *patch;
+		git_patch *patch;
 		const git_diff_delta *delta;
 		size_t h, num_h;
 
-		cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
 
 		cl_assert(delta);
 		cl_assert(patch);
 
 		file_count++;
 
-		num_h = git_diff_patch_num_hunks(patch);
+		num_h = git_patch_num_hunks(patch);
 
 		for (h = 0; h < num_h; h++) {
-			const git_diff_range *range;
+			const git_diff_hunk *range;
 			const char *header;
 			size_t header_len, num_l;
 
-			cl_git_pass(git_diff_patch_get_hunk(
+			cl_git_pass(git_patch_get_hunk(
 				&range, &header, &header_len, &num_l, patch, h));
 
 			cl_assert(range);
@@ -117,20 +117,20 @@ void test_diff_diffiter__iterate_files_and_hunks(void)
 			hunk_count++;
 		}
 
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	}
 
 	cl_assert_equal_i(13, file_count);
 	cl_assert_equal_i(8, hunk_count);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_diffiter__max_size_threshold(void)
 {
 	git_repository *repo = cl_git_sandbox_init("status");
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	int file_count = 0, binary_count = 0, hunk_count = 0;
 	size_t d, num_d;
 
@@ -142,27 +142,27 @@ void test_diff_diffiter__max_size_threshold(void)
 	num_d = git_diff_num_deltas(diff);
 
 	for (d = 0; d < num_d; ++d) {
-		git_diff_patch *patch;
+		git_patch *patch;
 		const git_diff_delta *delta;
 
-		cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
 		cl_assert(delta);
 		cl_assert(patch);
 
 		file_count++;
-		hunk_count += (int)git_diff_patch_num_hunks(patch);
+		hunk_count += (int)git_patch_num_hunks(patch);
 
 		assert((delta->flags & (GIT_DIFF_FLAG_BINARY|GIT_DIFF_FLAG_NOT_BINARY)) != 0);
 		binary_count += ((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
 
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	}
 
 	cl_assert_equal_i(13, file_count);
 	cl_assert_equal_i(0, binary_count);
 	cl_assert_equal_i(8, hunk_count);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* try again with low file size threshold */
 
@@ -177,18 +177,18 @@ void test_diff_diffiter__max_size_threshold(void)
 	num_d = git_diff_num_deltas(diff);
 
 	for (d = 0; d < num_d; ++d) {
-		git_diff_patch *patch;
+		git_patch *patch;
 		const git_diff_delta *delta;
 
-		cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
 
 		file_count++;
-		hunk_count += (int)git_diff_patch_num_hunks(patch);
+		hunk_count += (int)git_patch_num_hunks(patch);
 
 		assert((delta->flags & (GIT_DIFF_FLAG_BINARY|GIT_DIFF_FLAG_NOT_BINARY)) != 0);
 		binary_count += ((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
 
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	}
 
 	cl_assert_equal_i(13, file_count);
@@ -200,7 +200,7 @@ void test_diff_diffiter__max_size_threshold(void)
 	cl_assert_equal_i(3, binary_count);
 	cl_assert_equal_i(5, hunk_count);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 
@@ -208,7 +208,7 @@ void test_diff_diffiter__iterate_all(void)
 {
 	git_repository *repo = cl_git_sandbox_init("status");
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp = {0};
 	size_t d, num_d;
 
@@ -220,21 +220,21 @@ void test_diff_diffiter__iterate_all(void)
 
 	num_d = git_diff_num_deltas(diff);
 	for (d = 0; d < num_d; ++d) {
-		git_diff_patch *patch;
+		git_patch *patch;
 		const git_diff_delta *delta;
 		size_t h, num_h;
 
-		cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
 		cl_assert(patch && delta);
 		exp.files++;
 
-		num_h = git_diff_patch_num_hunks(patch);
+		num_h = git_patch_num_hunks(patch);
 		for (h = 0; h < num_h; h++) {
-			const git_diff_range *range;
+			const git_diff_hunk *range;
 			const char *header;
 			size_t header_len, l, num_l;
 
-			cl_git_pass(git_diff_patch_get_hunk(
+			cl_git_pass(git_patch_get_hunk(
 				&range, &header, &header_len, &num_l, patch, h));
 			cl_assert(range && header);
 			exp.hunks++;
@@ -244,33 +244,33 @@ void test_diff_diffiter__iterate_all(void)
 				const char *content;
 				size_t content_len;
 
-				cl_git_pass(git_diff_patch_get_line_in_hunk(
+				cl_git_pass(git_patch_get_line_in_hunk(
 					&origin, &content, &content_len, NULL, NULL, patch, h, l));
 				cl_assert(content);
 				exp.lines++;
 			}
 		}
 
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	}
 
 	cl_assert_equal_i(13, exp.files);
 	cl_assert_equal_i(8, exp.hunks);
 	cl_assert_equal_i(14, exp.lines);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
-static void iterate_over_patch(git_diff_patch *patch, diff_expects *exp)
+static void iterate_over_patch(git_patch *patch, diff_expects *exp)
 {
-	size_t h, num_h = git_diff_patch_num_hunks(patch), num_l;
+	size_t h, num_h = git_patch_num_hunks(patch), num_l;
 
 	exp->files++;
 	exp->hunks += (int)num_h;
 
 	/* let's iterate in reverse, just because we can! */
 	for (h = 1, num_l = 0; h <= num_h; ++h)
-		num_l += git_diff_patch_num_lines_in_hunk(patch, num_h - h);
+		num_l += git_patch_num_lines_in_hunk(patch, num_h - h);
 
 	exp->lines += (int)num_l;
 }
@@ -281,9 +281,9 @@ void test_diff_diffiter__iterate_randomly_while_saving_state(void)
 {
 	git_repository *repo = cl_git_sandbox_init("status");
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp = {0};
-	git_diff_patch *patches[PATCH_CACHE];
+	git_patch *patches[PATCH_CACHE];
 	size_t p, d, num_d;
 
 	memset(patches, 0, sizeof(patches));
@@ -308,32 +308,32 @@ void test_diff_diffiter__iterate_randomly_while_saving_state(void)
 
 	for (d = 0; d < num_d; ++d) {
 		/* take old patch */
-		git_diff_patch *patch = patches[p];
+		git_patch *patch = patches[p];
 		patches[p] = NULL;
 
 		/* cache new patch */
-		cl_git_pass(git_diff_get_patch(&patches[p], NULL, diff, d));
+		cl_git_pass(git_patch_from_diff(&patches[p], NULL, diff, d));
 		cl_assert(patches[p] != NULL);
 
 		/* process old patch if non-NULL */
 		if (patch != NULL) {
 			iterate_over_patch(patch, &exp);
-			git_diff_patch_free(patch);
+			git_patch_free(patch);
 		}
 
 		p = rand() % PATCH_CACHE;
 	}
 
 	/* free diff list now - refcounts should keep things safe */
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* process remaining unprocessed patches */
 	for (p = 0; p < PATCH_CACHE; p++) {
-		git_diff_patch *patch = patches[p];
+		git_patch *patch = patches[p];
 
 		if (patch != NULL) {
 			iterate_over_patch(patch, &exp);
-			git_diff_patch_free(patch);
+			git_patch_free(patch);
 		}
 	}
 
@@ -416,7 +416,7 @@ static const char *expected_patch_text[8] = {
 void test_diff_diffiter__iterate_and_generate_patch_text(void)
 {
 	git_repository *repo = cl_git_sandbox_init("status");
-	git_diff_list *diff;
+	git_diff *diff;
 	size_t d, num_d;
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, repo, NULL, NULL));
@@ -425,28 +425,28 @@ void test_diff_diffiter__iterate_and_generate_patch_text(void)
 	cl_assert_equal_i(8, (int)num_d);
 
 	for (d = 0; d < num_d; ++d) {
-		git_diff_patch *patch;
+		git_patch *patch;
 		char *text;
 
-		cl_git_pass(git_diff_get_patch(&patch, NULL, diff, d));
+		cl_git_pass(git_patch_from_diff(&patch, NULL, diff, d));
 		cl_assert(patch != NULL);
 
-		cl_git_pass(git_diff_patch_to_str(&text, patch));
+		cl_git_pass(git_patch_to_str(&text, patch));
 
 		cl_assert_equal_s(expected_patch_text[d], text);
 
 		git__free(text);
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_diffiter__checks_options_version(void)
 {
 	git_repository *repo = cl_git_sandbox_init("status");
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	const git_error *err;
 
 	opts.version = 0;
diff --git a/tests-clar/diff/drivers.c b/tests-clar/diff/drivers.c
index 719d229..518f24e 100644
--- a/tests-clar/diff/drivers.c
+++ b/tests-clar/diff/drivers.c
@@ -20,8 +20,8 @@ void test_diff_drivers__patterns(void)
 	git_config *cfg;
 	const char *one_sha = "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13";
 	git_tree *one;
-	git_diff_list *diff;
-	git_diff_patch *patch;
+	git_diff *diff;
+	git_patch *patch;
 	char *text;
 	const char *expected0 = "diff --git a/untimely.txt b/untimely.txt\nindex 9a69d96..57fd0cf 100644\n--- a/untimely.txt\n+++ b/untimely.txt\n@@ -22,3 +22,5 @@ Comes through the blood of the vanguards who\n   dreamed--too soon--it had sounded.\r\n \r\n                 -- Rudyard Kipling\r\n+\r\n+Some new stuff\r\n";
 	const char *expected1 = "diff --git a/untimely.txt b/untimely.txt\nindex 9a69d96..57fd0cf 100644\nBinary files a/untimely.txt and b/untimely.txt differ\n";
@@ -35,7 +35,7 @@ void test_diff_drivers__patterns(void)
 
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
 	cl_assert_equal_i(0, (int)git_diff_num_deltas(diff));
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* default diff */
 
@@ -44,13 +44,13 @@ void test_diff_drivers__patterns(void)
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected0, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	/* attribute diff set to false */
 
@@ -59,13 +59,13 @@ void test_diff_drivers__patterns(void)
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected1, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	/* attribute diff set to unconfigured value (should use default) */
 
@@ -74,13 +74,13 @@ void test_diff_drivers__patterns(void)
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected0, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	/* let's define that driver */
 
@@ -91,13 +91,13 @@ void test_diff_drivers__patterns(void)
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected1, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	/* let's use a real driver with some regular expressions */
 
@@ -112,13 +112,13 @@ void test_diff_drivers__patterns(void)
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected2, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	git_tree_free(one);
 }
@@ -127,8 +127,8 @@ void test_diff_drivers__long_lines(void)
 {
 	const char *base = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non nisi ligula. Ut viverra enim sed lobortis suscipit.\nPhasellus eget erat odio. Praesent at est iaculis, ultricies augue vel, dignissim risus. Suspendisse at nisi quis turpis fringilla rutrum id sit amet nulla.\nNam eget dolor fermentum, aliquet nisl at, convallis tellus. Pellentesque rhoncus erat enim, id porttitor elit euismod quis.\nMauris sollicitudin magna odio, non egestas libero vehicula ut. Etiam et quam velit. Fusce eget libero rhoncus, ultricies felis sit amet, egestas purus.\nAliquam in semper tellus. Pellentesque adipiscing rutrum velit, quis malesuada lacus consequat eget.\n";
 	git_index *idx;
-	git_diff_list *diff;
-	git_diff_patch *patch;
+	git_diff *diff;
+	git_patch *patch;
 	char *actual;
 	const char *expected = "diff --git a/longlines.txt b/longlines.txt\nindex c1ce6ef..0134431 100644\n--- a/longlines.txt\n+++ b/longlines.txt\n@@ -3,3 +3,5 @@ Phasellus eget erat odio. Praesent at est iaculis, ultricies augue vel, dignissi\n Nam eget dolor fermentum, aliquet nisl at, convallis tellus. Pellentesque rhoncus erat enim, id porttitor elit euismod quis.\n Mauris sollicitudin magna odio, non egestas libero vehicula ut. Etiam et quam velit. Fusce eget libero rhoncus, ultricies felis sit amet, egestas purus.\n Aliquam in semper tellus. Pellentesque adipiscing rutrum velit, quis malesuada lacus consequat eget.\n+newline\n+newline\n";
 
@@ -144,8 +144,8 @@ void test_diff_drivers__long_lines(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, NULL));
 	cl_assert_equal_sz(1, git_diff_num_deltas(diff));
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&actual, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&actual, patch));
 
 	/* if chmod not supported, overwrite mode bits since anything is possible */
 	if (!cl_is_chmod_supported()) {
@@ -157,7 +157,7 @@ void test_diff_drivers__long_lines(void)
 	cl_assert_equal_s(expected, actual);
 
 	free(actual);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 }
 
diff --git a/tests-clar/diff/index.c b/tests-clar/diff/index.c
index e1c617d..8f45671 100644
--- a/tests-clar/diff/index.c
+++ b/tests-clar/diff/index.c
@@ -21,7 +21,7 @@ void test_diff_index__0(void)
 	git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
 	git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit);
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 
 	cl_assert(a);
@@ -56,7 +56,7 @@ void test_diff_index__0(void)
 	cl_assert_equal_i(6, exp.line_adds);
 	cl_assert_equal_i(2, exp.line_dels);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 	memset(&exp, 0, sizeof(exp));
 
@@ -84,7 +84,7 @@ void test_diff_index__0(void)
 	cl_assert_equal_i(11, exp.line_adds);
 	cl_assert_equal_i(2, exp.line_dels);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	git_tree_free(a);
@@ -114,7 +114,7 @@ void test_diff_index__1(void)
 	git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
 	git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit);
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 
 	cl_assert(a);
@@ -134,7 +134,7 @@ void test_diff_index__1(void)
 
 	cl_assert_equal_i(2, exp.files);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	git_tree_free(a);
@@ -146,7 +146,7 @@ void test_diff_index__checks_options_version(void)
 	const char *a_commit = "26a125ee1bf";
 	git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	const git_error *err;
 
 	opts.version = 0;
diff --git a/tests-clar/diff/notify.c b/tests-clar/diff/notify.c
index 433b4a9..cc33cb7 100644
--- a/tests-clar/diff/notify.c
+++ b/tests-clar/diff/notify.c
@@ -13,7 +13,7 @@ void test_diff_notify__cleanup(void)
 }
 
 static int assert_called_notifications(
-	const git_diff_list *diff_so_far,
+	const git_diff *diff_so_far,
 	const git_diff_delta *delta_to_add,
 	const char *matched_pathspec,
 	void *payload)
@@ -45,7 +45,7 @@ static void test_notify(
 	int expected_diffed_files_count)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 
 	g_repo = cl_git_sandbox_init("status");
@@ -63,7 +63,7 @@ static void test_notify(
 
 	cl_assert_equal_i(expected_diffed_files_count, exp.files);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_notify__notify_single_pathspec(void)
@@ -155,7 +155,7 @@ void test_diff_notify__notify_catchall(void)
 }
 
 static int abort_diff(
-	const git_diff_list *diff_so_far,
+	const git_diff *diff_so_far,
 	const git_diff_delta *delta_to_add,
 	const char *matched_pathspec,
 	void *payload)
@@ -171,7 +171,7 @@ static int abort_diff(
 void test_diff_notify__notify_cb_can_abort_diff(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	char *pathspec = NULL;
 
 	g_repo = cl_git_sandbox_init("status");
@@ -189,7 +189,7 @@ void test_diff_notify__notify_cb_can_abort_diff(void)
 }
 
 static int filter_all(
-	const git_diff_list *diff_so_far,
+	const git_diff *diff_so_far,
 	const git_diff_delta *delta_to_add,
 	const char *matched_pathspec,
 	void *payload)
@@ -205,7 +205,7 @@ static int filter_all(
 void test_diff_notify__notify_cb_can_be_used_as_filtering_function(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	char *pathspec = NULL;
 	diff_expects exp;
 
@@ -224,5 +224,5 @@ void test_diff_notify__notify_cb_can_be_used_as_filtering_function(void)
 
 	cl_assert_equal_i(0, exp.files);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
diff --git a/tests-clar/diff/patch.c b/tests-clar/diff/patch.c
index 171abc8..e5d8fca 100644
--- a/tests-clar/diff/patch.c
+++ b/tests-clar/diff/patch.c
@@ -26,7 +26,7 @@ void test_diff_patch__cleanup(void)
 
 static int check_removal_cb(
 	const git_diff_delta *delta,
-	const git_diff_range *range,
+	const git_diff_hunk *range,
 	char line_origin,
 	const char *formatted_output,
 	size_t output_len,
@@ -86,7 +86,7 @@ void test_diff_patch__can_properly_display_the_removal_of_a_file(void)
 	const char *one_sha = "26a125e";
 	const char *another_sha = "735b6a2";
 	git_tree *one, *another;
-	git_diff_list *diff;
+	git_diff *diff;
 
 	g_repo = cl_git_sandbox_init("status");
 
@@ -97,7 +97,7 @@ void test_diff_patch__can_properly_display_the_removal_of_a_file(void)
 
 	cl_git_pass(git_diff_print_patch(diff, check_removal_cb, NULL));
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_tree_free(another);
 	git_tree_free(one);
@@ -108,8 +108,8 @@ void test_diff_patch__to_string(void)
 	const char *one_sha = "26a125e";
 	const char *another_sha = "735b6a2";
 	git_tree *one, *another;
-	git_diff_list *diff;
-	git_diff_patch *patch;
+	git_diff *diff;
+	git_patch *patch;
 	char *text;
 	const char *expected = "diff --git a/subdir.txt b/subdir.txt\ndeleted file mode 100644\nindex e8ee89e..0000000\n--- a/subdir.txt\n+++ /dev/null\n@@ -1,2 +0,0 @@\n-Is it a bird?\n-Is it a plane?\n";
 
@@ -122,20 +122,20 @@ void test_diff_patch__to_string(void)
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
 
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_to_str(&text, patch));
 
 	cl_assert_equal_s(expected, text);
 
-	cl_assert_equal_sz(31, git_diff_patch_size(patch, 0, 0, 0));
-	cl_assert_equal_sz(31, git_diff_patch_size(patch, 1, 0, 0));
-	cl_assert_equal_sz(31 + 16, git_diff_patch_size(patch, 1, 1, 0));
-	cl_assert_equal_sz(strlen(expected), git_diff_patch_size(patch, 1, 1, 1));
+	cl_assert_equal_sz(31, git_patch_size(patch, 0, 0, 0));
+	cl_assert_equal_sz(31, git_patch_size(patch, 1, 0, 0));
+	cl_assert_equal_sz(31 + 16, git_patch_size(patch, 1, 1, 0));
+	cl_assert_equal_sz(strlen(expected), git_patch_size(patch, 1, 1, 1));
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 	git_tree_free(another);
 	git_tree_free(one);
 }
@@ -145,8 +145,8 @@ void test_diff_patch__config_options(void)
 	const char *one_sha = "26a125e"; /* current HEAD */
 	git_tree *one;
 	git_config *cfg;
-	git_diff_list *diff;
-	git_diff_patch *patch;
+	git_diff *diff;
+	git_patch *patch;
 	char *text;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	char *onefile = "staged_changes_modified_file";
@@ -167,24 +167,24 @@ void test_diff_patch__config_options(void)
 	cl_git_pass(git_diff_tree_to_index(&diff, g_repo, one, NULL, &opts));
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected1, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected2, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 
 	cl_git_pass(git_config_set_string(cfg, "diff.noprefix", "true"));
@@ -192,13 +192,13 @@ void test_diff_patch__config_options(void)
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected3, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 
 	cl_git_pass(git_config_set_int32(cfg, "core.abbrev", 12));
@@ -206,13 +206,13 @@ void test_diff_patch__config_options(void)
 	cl_git_pass(git_diff_tree_to_index(&diff, g_repo, one, NULL, &opts));
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected4, text);
 
 	git__free(text);
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	git_tree_free(one);
 	git_config_free(cfg);
@@ -223,10 +223,10 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	git_config *cfg;
 	git_tree *head;
 	git_diff_options opt = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff;
-	git_diff_patch *patch;
+	git_diff *diff;
+	git_patch *patch;
 	const git_diff_delta *delta;
-	const git_diff_range *range;
+	const git_diff_hunk *range;
 	const char *hdr, *text;
 	size_t hdrlen, hunklen, textlen;
 	char origin;
@@ -253,15 +253,15 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+	cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
 
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
-	cl_assert_equal_i(2, (int)git_diff_patch_num_hunks(patch));
+	cl_assert_equal_i(2, (int)git_patch_num_hunks(patch));
 
 	/* check hunk 0 */
 
 	cl_git_pass(
-		git_diff_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
+		git_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
 
 	cl_assert_equal_i(18, (int)hunklen);
 
@@ -270,9 +270,9 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(6, (int)range->new_start);
 	cl_assert_equal_i(9, (int)range->new_lines);
 
-	cl_assert_equal_i(18, (int)git_diff_patch_num_lines_in_hunk(patch, 0));
+	cl_assert_equal_i(18, (int)git_patch_num_lines_in_hunk(patch, 0));
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 0));
 	cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -280,7 +280,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(6, oldno);
 	cl_assert_equal_i(6, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 3));
 	cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -288,7 +288,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(9, oldno);
 	cl_assert_equal_i(-1, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 12));
 	cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -299,7 +299,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	/* check hunk 1 */
 
 	cl_git_pass(
-		git_diff_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 1));
+		git_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 1));
 
 	cl_assert_equal_i(18, (int)hunklen);
 
@@ -308,9 +308,9 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(25, (int)range->new_start);
 	cl_assert_equal_i(9, (int)range->new_lines);
 
-	cl_assert_equal_i(18, (int)git_diff_patch_num_lines_in_hunk(patch, 1));
+	cl_assert_equal_i(18, (int)git_patch_num_lines_in_hunk(patch, 1));
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 1, 0));
 	cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -318,7 +318,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(31, oldno);
 	cl_assert_equal_i(25, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 1, 3));
 	cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -326,7 +326,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(34, oldno);
 	cl_assert_equal_i(-1, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 1, 12));
 	cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -334,8 +334,8 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(-1, oldno);
 	cl_assert_equal_i(28, newno);
 
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	/* Let's check line numbers when there is no newline */
 
@@ -346,15 +346,15 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+	cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
 
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
-	cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(patch));
+	cl_assert_equal_i(1, (int)git_patch_num_hunks(patch));
 
 	/* check hunk 0 */
 
 	cl_git_pass(
-		git_diff_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
+		git_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
 
 	cl_assert_equal_i(6, (int)hunklen);
 
@@ -363,9 +363,9 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(46, (int)range->new_start);
 	cl_assert_equal_i(4, (int)range->new_lines);
 
-	cl_assert_equal_i(6, (int)git_diff_patch_num_lines_in_hunk(patch, 0));
+	cl_assert_equal_i(6, (int)git_patch_num_lines_in_hunk(patch, 0));
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 1));
 	cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -373,7 +373,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(47, oldno);
 	cl_assert_equal_i(47, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 2));
 	cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -381,7 +381,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(48, oldno);
 	cl_assert_equal_i(48, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 3));
 	cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -389,7 +389,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(49, oldno);
 	cl_assert_equal_i(-1, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 4));
 	cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -397,7 +397,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(-1, oldno);
 	cl_assert_equal_i(49, newno);
 
-	cl_git_pass(git_diff_patch_get_line_in_hunk(
+	cl_git_pass(git_patch_get_line_in_hunk(
 		&origin, &text, &textlen, &oldno, &newno, patch, 0, 5));
 	cl_assert_equal_i(GIT_DIFF_LINE_DEL_EOFNL, (int)origin);
 	cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -405,8 +405,8 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
 	cl_assert_equal_i(-1, oldno);
 	cl_assert_equal_i(49, newno);
 
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	git_buf_free(&actual);
 	git_buf_free(&old_content);
@@ -418,8 +418,8 @@ static void check_single_patch_stats(
 	size_t adds, size_t dels, size_t ctxt, size_t *sizes,
 	const char *expected)
 {
-	git_diff_list *diff;
-	git_diff_patch *patch;
+	git_diff *diff;
+	git_patch *patch;
 	const git_diff_delta *delta;
 	size_t actual_ctxt, actual_adds, actual_dels;
 
@@ -427,12 +427,12 @@ static void check_single_patch_stats(
 
 	cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+	cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
 
-	cl_assert_equal_i((int)hunks, (int)git_diff_patch_num_hunks(patch));
+	cl_assert_equal_i((int)hunks, (int)git_patch_num_hunks(patch));
 
-	cl_git_pass( git_diff_patch_line_stats(
+	cl_git_pass( git_patch_line_stats(
 		&actual_ctxt, &actual_adds, &actual_dels, patch) );
 
 	cl_assert_equal_sz(ctxt, actual_ctxt);
@@ -441,21 +441,21 @@ static void check_single_patch_stats(
 
 	if (expected != NULL) {
 		char *text;
-		cl_git_pass(git_diff_patch_to_str(&text, patch));
+		cl_git_pass(git_patch_to_str(&text, patch));
 		cl_assert_equal_s(expected, text);
 		git__free(text);
 
 		cl_assert_equal_sz(
-			strlen(expected), git_diff_patch_size(patch, 1, 1, 1));
+			strlen(expected), git_patch_size(patch, 1, 1, 1));
 	}
 
 	if (sizes) {
 		if (sizes[0])
-			cl_assert_equal_sz(sizes[0], git_diff_patch_size(patch, 0, 0, 0));
+			cl_assert_equal_sz(sizes[0], git_patch_size(patch, 0, 0, 0));
 		if (sizes[1])
-			cl_assert_equal_sz(sizes[1], git_diff_patch_size(patch, 1, 0, 0));
+			cl_assert_equal_sz(sizes[1], git_patch_size(patch, 1, 0, 0));
 		if (sizes[2])
-			cl_assert_equal_sz(sizes[2], git_diff_patch_size(patch, 1, 1, 0));
+			cl_assert_equal_sz(sizes[2], git_patch_size(patch, 1, 1, 0));
 	}
 
 	/* walk lines in hunk with basic sanity checks */
@@ -464,12 +464,12 @@ static void check_single_patch_stats(
 		int lastoldno = -1, oldno, lastnewno = -1, newno;
 		char origin;
 
-		max_i = git_diff_patch_num_lines_in_hunk(patch, hunks - 1);
+		max_i = git_patch_num_lines_in_hunk(patch, hunks - 1);
 
 		for (i = 0; i < max_i; ++i) {
 			int expected = 1;
 
-			cl_git_pass(git_diff_patch_get_line_in_hunk(
+			cl_git_pass(git_patch_get_line_in_hunk(
 				&origin, NULL, NULL, &oldno, &newno, patch, hunks - 1, i));
 
 			if (origin == GIT_DIFF_LINE_ADD_EOFNL ||
@@ -490,8 +490,8 @@ static void check_single_patch_stats(
 		}
 	}
 
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	git_patch_free(patch);
+	git_diff_free(diff);
 }
 
 void test_diff_patch__line_counts_with_eofnl(void)
diff --git a/tests-clar/diff/pathspec.c b/tests-clar/diff/pathspec.c
index 7b15ea0..5761d2d 100644
--- a/tests-clar/diff/pathspec.c
+++ b/tests-clar/diff/pathspec.c
@@ -20,7 +20,7 @@ void test_diff_pathspec__0(void)
 	git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
 	git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit);
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	git_strarray paths = { NULL, 1 };
 	char *path;
 	git_pathspec *ps;
@@ -52,7 +52,7 @@ void test_diff_pathspec__0(void)
 		(int)git_pathspec_match_list_diff_entry(matches,0)->status);
 	git_pathspec_match_list_free(matches);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	cl_git_pass(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts));
@@ -68,7 +68,7 @@ void test_diff_pathspec__0(void)
 		(int)git_pathspec_match_list_diff_entry(matches,0)->status);
 	git_pathspec_match_list_free(matches);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, a, &opts));
@@ -84,7 +84,7 @@ void test_diff_pathspec__0(void)
 		(int)git_pathspec_match_list_diff_entry(matches,0)->status);
 	git_pathspec_match_list_free(matches);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	git_tree_free(a);
diff --git a/tests-clar/diff/rename.c b/tests-clar/diff/rename.c
index 9864c58..45706fb 100644
--- a/tests-clar/diff/rename.c
+++ b/tests-clar/diff/rename.c
@@ -43,7 +43,7 @@ void test_diff_rename__match_oid(void)
 	const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
 	const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
 	git_tree *old_tree, *new_tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -88,7 +88,7 @@ void test_diff_rename__match_oid(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_pass(git_diff_tree_to_tree(
 		&diff, g_repo, old_tree, new_tree, &diffopts));
@@ -109,7 +109,7 @@ void test_diff_rename__match_oid(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_tree_free(old_tree);
 	git_tree_free(new_tree);
@@ -120,7 +120,7 @@ void test_diff_rename__checks_options_version(void)
 	const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
 	const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
 	git_tree *old_tree, *new_tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	const git_error *err;
@@ -142,7 +142,7 @@ void test_diff_rename__checks_options_version(void)
 	err = giterr_last();
 	cl_assert_equal_i(GITERR_INVALID, err->klass);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(old_tree);
 	git_tree_free(new_tree);
 }
@@ -153,7 +153,7 @@ void test_diff_rename__not_exact_match(void)
 	const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
 	const char *sha2 = "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13";
 	git_tree *old_tree, *new_tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -207,7 +207,7 @@ void test_diff_rename__not_exact_match(void)
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* git diff -M -C \
 	 *          2bc7f351d20b53f1c72c16c4b036e491c478c49a \
@@ -228,7 +228,7 @@ void test_diff_rename__not_exact_match(void)
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* git diff -M -C --find-copies-harder --break-rewrites \
 	 *          2bc7f351d20b53f1c72c16c4b036e491c478c49a \
@@ -253,7 +253,7 @@ void test_diff_rename__not_exact_match(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* == Changes =====================================================
 	 * songofseven.txt -> untimely.txt    (rename, convert to crlf)
@@ -281,7 +281,7 @@ void test_diff_rename__not_exact_match(void)
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* git diff -M -C \
 	 *          1c068dee5790ef1580cfc4cd670915b48d790084 \
@@ -301,7 +301,7 @@ void test_diff_rename__not_exact_match(void)
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* git diff -M -C --find-copies-harder --break-rewrites \
 	 *          1c068dee5790ef1580cfc4cd670915b48d790084 \
@@ -330,7 +330,7 @@ void test_diff_rename__not_exact_match(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* git diff -M -C --find-copies-harder --break-rewrites \
 	 *          1c068dee5790ef1580cfc4cd670915b48d790084 \
@@ -353,7 +353,7 @@ void test_diff_rename__not_exact_match(void)
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_tree_free(old_tree);
 	git_tree_free(new_tree);
@@ -364,7 +364,7 @@ void test_diff_rename__handles_small_files(void)
 	const char *tree_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 
@@ -388,7 +388,7 @@ void test_diff_rename__handles_small_files(void)
 		GIT_DIFF_FIND_AND_BREAK_REWRITES;
 	cl_git_pass(git_diff_find_similar(diff, &opts));
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 }
@@ -400,7 +400,7 @@ void test_diff_rename__working_directory_changes(void)
 	git_oid id;
 	git_tree *tree;
 	git_blob *blob;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -451,7 +451,7 @@ void test_diff_rename__working_directory_changes(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* rewrite files in the working directory with / without CRLF changes */
 
@@ -477,7 +477,7 @@ void test_diff_rename__working_directory_changes(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* try a different whitespace option */
 
@@ -496,7 +496,7 @@ void test_diff_rename__working_directory_changes(void)
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
 	cl_assert_equal_i(3, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* try a different matching option */
 
@@ -514,7 +514,7 @@ void test_diff_rename__working_directory_changes(void)
 	cl_assert_equal_i(3, exp.file_status[GIT_DELTA_UNTRACKED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* again with exact match blob */
 
@@ -545,7 +545,7 @@ void test_diff_rename__working_directory_changes(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_tree_free(tree);
 	git_buf_free(&content);
@@ -557,10 +557,10 @@ void test_diff_rename__patch(void)
 	const char *sha0 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
 	const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
 	git_tree *old_tree, *new_tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
-	git_diff_patch *patch;
+	git_patch *patch;
 	const git_diff_delta *delta;
 	char *text;
 	const char *expected = "diff --git a/sixserving.txt b/ikeepsix.txt\nindex ad0a8e5..36020db 100644\n--- a/sixserving.txt\n+++ b/ikeepsix.txt\n@@ -1,3 +1,6 @@\n+I Keep Six Honest Serving-Men\n+=============================\n+\n I KEEP six honest serving-men\n  (They taught me all I knew);\n Their names are What and Why and When\n@@ -21,4 +24,4 @@ She sends'em abroad on her own affairs,\n One million Hows, two million Wheres,\n And seven million Whys!\n \n-                -- Rudyard Kipling\n+  -- Rudyard Kipling\n";
@@ -584,25 +584,25 @@ void test_diff_rename__patch(void)
 
 	cl_assert_equal_i(4, (int)git_diff_num_deltas(diff));
 
-	cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+	cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
 	cl_assert_equal_i(GIT_DELTA_COPIED, (int)delta->status);
 
-	cl_git_pass(git_diff_patch_to_str(&text, patch));
+	cl_git_pass(git_patch_to_str(&text, patch));
 	cl_assert_equal_s(expected, text);
 	git__free(text);
 
-	git_diff_patch_free(patch);
+	git_patch_free(patch);
 
-	cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 1));
+	cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 1));
 	cl_assert_equal_i(GIT_DELTA_UNMODIFIED, (int)delta->status);
 
-	cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 2));
+	cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 2));
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
 
-	cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 3));
+	cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 3));
 	cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(old_tree);
 	git_tree_free(new_tree);
 }
@@ -612,7 +612,7 @@ void test_diff_rename__file_exchange(void)
 	git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT;
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -647,7 +647,7 @@ void test_diff_rename__file_exchange(void)
 	cl_assert_equal_i(2, exp.files);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 
@@ -660,7 +660,7 @@ void test_diff_rename__file_exchange_three(void)
 	git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT, c3 = GIT_BUF_INIT;
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -699,7 +699,7 @@ void test_diff_rename__file_exchange_three(void)
 	cl_assert_equal_i(3, exp.files);
 	cl_assert_equal_i(3, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 
@@ -713,7 +713,7 @@ void test_diff_rename__file_partial_exchange(void)
 	git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT;
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -752,7 +752,7 @@ void test_diff_rename__file_partial_exchange(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 
@@ -765,7 +765,7 @@ void test_diff_rename__rename_and_copy_from_same_source(void)
 	git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT;
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -809,7 +809,7 @@ void test_diff_rename__rename_and_copy_from_same_source(void)
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_COPIED]);
 	cl_assert_equal_i(4, exp.file_status[GIT_DELTA_UNMODIFIED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 
@@ -822,7 +822,7 @@ void test_diff_rename__from_deleted_to_split(void)
 	git_buf c1 = GIT_BUF_INIT;
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 	diff_expects exp;
@@ -863,7 +863,7 @@ void test_diff_rename__from_deleted_to_split(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNMODIFIED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 
@@ -907,7 +907,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
 	git_index *index;
 	git_tree *tree;
 	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
 	git_buf one = GIT_BUF_INIT, two = GIT_BUF_INIT;
@@ -961,7 +961,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
 	cl_git_pass(
 		git_diff_foreach(diff, test_names_expected, NULL, NULL, &expect));
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 	git_reference_free(head);
@@ -993,7 +993,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
 	git_index *index;
 	git_tree *tree;
 	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
 	unsigned int status[] = { GIT_DELTA_RENAMED, GIT_DELTA_RENAMED };
@@ -1035,7 +1035,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
 		git_diff_foreach(diff, test_names_expected, NULL, NULL, &expect));
 	cl_assert(expect.idx > 0);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 	git_reference_free(head);
@@ -1048,7 +1048,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
 	git_index *index;
 	git_tree *tree;
 	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
 
@@ -1091,7 +1091,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
 
 	cl_assert(expect.idx == expect.len);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 	git_reference_free(head);
@@ -1102,7 +1102,7 @@ void test_diff_rename__can_rename_from_rewrite(void)
 {
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
 
@@ -1140,7 +1140,7 @@ void test_diff_rename__can_rename_from_rewrite(void)
 
 	cl_assert(expect.idx == expect.len);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(tree);
 	git_index_free(index);
 }
@@ -1149,7 +1149,7 @@ void test_diff_rename__case_changes_are_split(void)
 {
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
 
@@ -1182,7 +1182,7 @@ void test_diff_rename__case_changes_are_split(void)
 	cl_assert_equal_i(1, exp.files);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_index_free(index);
 	git_tree_free(tree);
 }
@@ -1191,7 +1191,7 @@ void test_diff_rename__unmodified_can_be_renamed(void)
 {
 	git_index *index;
 	git_tree *tree;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -1230,7 +1230,7 @@ void test_diff_rename__unmodified_can_be_renamed(void)
 	cl_assert_equal_i(1, exp.files);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_index_free(index);
 	git_tree_free(tree);
 }
@@ -1238,7 +1238,7 @@ void test_diff_rename__unmodified_can_be_renamed(void)
 void test_diff_rename__rewrite_on_single_file(void)
 {
 	git_index *index;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -1280,6 +1280,6 @@ void test_diff_rename__rewrite_on_single_file(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_index_free(index);
 }
diff --git a/tests-clar/diff/submodules.c b/tests-clar/diff/submodules.c
index 036ff09..24283e2 100644
--- a/tests-clar/diff/submodules.c
+++ b/tests-clar/diff/submodules.c
@@ -14,15 +14,15 @@ void test_diff_submodules__cleanup(void)
 }
 
 static void check_diff_patches_at_line(
-	git_diff_list *diff, const char **expected, const char *file, int line)
+	git_diff *diff, const char **expected, const char *file, int line)
 {
 	const git_diff_delta *delta;
-	git_diff_patch *patch = NULL;
+	git_patch *patch = NULL;
 	size_t d, num_d = git_diff_num_deltas(diff);
 	char *patch_text;
 
-	for (d = 0; d < num_d; ++d, git_diff_patch_free(patch)) {
-		cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+	for (d = 0; d < num_d; ++d, git_patch_free(patch)) {
+		cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
 
 		if (delta->status == GIT_DELTA_UNMODIFIED) {
 			cl_assert_at_line(expected[d] == NULL, file, line);
@@ -32,11 +32,11 @@ static void check_diff_patches_at_line(
 		if (expected[d] && !strcmp(expected[d], "<SKIP>"))
 			continue;
 		if (expected[d] && !strcmp(expected[d], "<END>")) {
-			cl_git_pass(git_diff_patch_to_str(&patch_text, patch));
+			cl_git_pass(git_patch_to_str(&patch_text, patch));
 			cl_assert_at_line(!strcmp(expected[d], "<END>"), file, line);
 		}
 
-		cl_git_pass(git_diff_patch_to_str(&patch_text, patch));
+		cl_git_pass(git_patch_to_str(&patch_text, patch));
 
 		clar__assert_equal(
 			file, line, "expected diff did not match actual diff", 1,
@@ -53,7 +53,7 @@ static void check_diff_patches_at_line(
 void test_diff_submodules__unmodified_submodule(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	static const char *expected[] = {
 		"<SKIP>", /* .gitmodules */
 		NULL, /* added */
@@ -74,13 +74,13 @@ void test_diff_submodules__unmodified_submodule(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_submodules__dirty_submodule(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	static const char *expected[] = {
 		"<SKIP>", /* .gitmodules */
 		NULL, /* added */
@@ -104,13 +104,13 @@ void test_diff_submodules__dirty_submodule(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_submodules__dirty_submodule_2(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL, *diff2 = NULL;
+	git_diff *diff = NULL, *diff2 = NULL;
 	char *smpath = "testrepo";
 	static const char *expected_none[] = { "<END>" };
 	static const char *expected_dirty[] = {
@@ -132,7 +132,7 @@ void test_diff_submodules__dirty_submodule_2(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_none);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_rewritefile("submodules/testrepo/README", "heyheyhey");
 	cl_git_mkfile("submodules/testrepo/all_new.txt", "never seen before");
@@ -146,25 +146,25 @@ void test_diff_submodules__dirty_submodule_2(void)
 		cl_git_pass(git_repository_head_tree(&head, g_repo));
 		cl_git_pass(git_diff_tree_to_index(&diff2, g_repo, head, NULL, &opts));
 		cl_git_pass(git_diff_merge(diff, diff2));
-		git_diff_list_free(diff2);
+		git_diff_free(diff2);
 		git_tree_free(head);
 
 		check_diff_patches(diff, expected_dirty);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_pass(git_submodule_reload_all(g_repo));
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_submodules__submod2_index_to_wd(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	static const char *expected[] = {
 		"<SKIP>", /* .gitmodules */
 		"diff --git a/sm_changed_file b/sm_changed_file\nindex 4800958..4800958 160000\n--- a/sm_changed_file\n+++ b/sm_changed_file\n@@ -1 +1 @@\n-Subproject commit 480095882d281ed676fe5b863569520e54a7d5c0\n+Subproject commit 480095882d281ed676fe5b863569520e54a7d5c0-dirty\n", /* sm_changed_file */
@@ -182,14 +182,14 @@ void test_diff_submodules__submod2_index_to_wd(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_submodules__submod2_head_to_index(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	git_tree *head;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	static const char *expected[] = {
 		"<SKIP>", /* .gitmodules */
 		"diff --git a/sm_added_and_uncommited b/sm_added_and_uncommited\nnew file mode 160000\nindex 0000000..4800958\n--- /dev/null\n+++ b/sm_added_and_uncommited\n@@ -0,0 +1 @@\n+Subproject commit 480095882d281ed676fe5b863569520e54a7d5c0\n", /* sm_added_and_uncommited */
@@ -205,7 +205,7 @@ void test_diff_submodules__submod2_head_to_index(void)
 
 	cl_git_pass(git_diff_tree_to_index(&diff, g_repo, head, NULL, &opts));
 	check_diff_patches(diff, expected);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_tree_free(head);
 }
@@ -213,7 +213,7 @@ void test_diff_submodules__submod2_head_to_index(void)
 void test_diff_submodules__invalid_cache(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	git_submodule *sm;
 	char *smpath = "sm_changed_head";
 	git_repository *smrepo;
@@ -246,7 +246,7 @@ void test_diff_submodules__invalid_cache(void)
 	/* baseline */
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_baseline);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* update index with new HEAD */
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, smpath));
@@ -254,7 +254,7 @@ void test_diff_submodules__invalid_cache(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_unchanged);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* create untracked file in submodule working directory */
 	cl_git_mkfile("submod2/sm_changed_head/new_around_here", "hello");
@@ -262,13 +262,13 @@ void test_diff_submodules__invalid_cache(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_UNTRACKED);
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_unchanged);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* modify tracked file in submodule working directory */
 	cl_git_append2file(
@@ -276,20 +276,20 @@ void test_diff_submodules__invalid_cache(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_pass(git_submodule_reload_all(g_repo));
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, smpath));
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_DIRTY);
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_unchanged);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* add file to index in submodule */
 	cl_git_pass(git_submodule_open(&smrepo, sm));
@@ -300,13 +300,13 @@ void test_diff_submodules__invalid_cache(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_DIRTY);
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_unchanged);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* commit changed index of submodule */
 	cl_repo_commit_from_index(NULL, smrepo, NULL, 1372350000, "Move it");
@@ -315,25 +315,25 @@ void test_diff_submodules__invalid_cache(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_moved);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_ALL);
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_unchanged);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_NONE);
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_moved_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	p_unlink("submod2/sm_changed_head/new_around_here");
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_moved);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_index_free(smindex);
 	git_repository_free(smrepo);
@@ -342,7 +342,7 @@ void test_diff_submodules__invalid_cache(void)
 void test_diff_submodules__diff_ignore_options(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	git_config *cfg;
 	static const char *expected_normal[] = {
 		"<SKIP>", /* .gitmodules */
@@ -371,26 +371,26 @@ void test_diff_submodules__diff_ignore_options(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_normal);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	opts.flags |= GIT_DIFF_IGNORE_SUBMODULES;
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_ignore_all);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	opts.flags &= ~GIT_DIFF_IGNORE_SUBMODULES;
 	opts.ignore_submodules = GIT_SUBMODULE_IGNORE_ALL;
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_ignore_all);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	opts.ignore_submodules = GIT_SUBMODULE_IGNORE_DIRTY;
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_ignore_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	opts.ignore_submodules = 0;
 	cl_git_pass(git_repository_config(&cfg, g_repo));
@@ -398,25 +398,25 @@ void test_diff_submodules__diff_ignore_options(void)
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_normal);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_pass(git_config_set_bool(cfg, "diff.ignoreSubmodules", true));
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_ignore_all);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_pass(git_config_set_string(cfg, "diff.ignoreSubmodules", "none"));
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_normal);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_pass(git_config_set_string(cfg, "diff.ignoreSubmodules", "dirty"));
 
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 	check_diff_patches(diff, expected_ignore_dirty);
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_config_free(cfg);
 }
diff --git a/tests-clar/diff/tree.c b/tests-clar/diff/tree.c
index f05c786..7286ee1 100644
--- a/tests-clar/diff/tree.c
+++ b/tests-clar/diff/tree.c
@@ -3,7 +3,7 @@
 
 static git_repository *g_repo = NULL;
 static git_diff_options opts;
-static git_diff_list *diff;
+static git_diff *diff;
 static git_tree *a, *b;
 static diff_expects expect;
 
@@ -22,7 +22,7 @@ void test_diff_tree__initialize(void)
 
 void test_diff_tree__cleanup(void)
 {
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(a);
 	git_tree_free(b);
 
@@ -65,7 +65,7 @@ void test_diff_tree__0(void)
 	cl_assert_equal_i(24 + 1 + 5 + 5, expect.line_adds);
 	cl_assert_equal_i(7 + 1, expect.line_dels);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	memset(&expect, 0, sizeof(expect));
@@ -168,7 +168,7 @@ void test_diff_tree__options(void)
 		cl_assert_equal_i(actual.line_adds, expected->line_adds);
 		cl_assert_equal_i(actual.line_dels, expected->line_dels);
 
-		git_diff_list_free(diff);
+		git_diff_free(diff);
 		diff = NULL;
 	}
 
@@ -214,7 +214,7 @@ void test_diff_tree__merge(void)
 	const char *b_commit = "370fe9ec22";
 	const char *c_commit = "f5b0af1fb4f5c";
 	git_tree *c;
-	git_diff_list *diff1 = NULL, *diff2 = NULL;
+	git_diff *diff1 = NULL, *diff2 = NULL;
 
 	g_repo = cl_git_sandbox_init("attr");
 
@@ -230,7 +230,7 @@ void test_diff_tree__merge(void)
 
 	cl_git_pass(git_diff_merge(diff1, diff2));
 
-	git_diff_list_free(diff2);
+	git_diff_free(diff2);
 
 	cl_git_pass(git_diff_foreach(
 		diff1, diff_file_cb, diff_hunk_cb, diff_line_cb, &expect));
@@ -247,7 +247,7 @@ void test_diff_tree__merge(void)
 	cl_assert_equal_i(36, expect.line_adds);
 	cl_assert_equal_i(22, expect.line_dels);
 
-	git_diff_list_free(diff1);
+	git_diff_free(diff1);
 }
 
 void test_diff_tree__larger_hunks(void)
@@ -256,8 +256,8 @@ void test_diff_tree__larger_hunks(void)
 	const char *b_commit = "7a9e0b02e63179929fed24f0a3e0f19168114d10";
 	size_t d, num_d, h, num_h, l, num_l, header_len, line_len;
 	const git_diff_delta *delta;
-	git_diff_patch *patch;
-	const git_diff_range *range;
+	git_patch *patch;
+	const git_diff_hunk *range;
 	const char *header, *line;
 	char origin;
 
@@ -273,31 +273,31 @@ void test_diff_tree__larger_hunks(void)
 
 	num_d = git_diff_num_deltas(diff);
 	for (d = 0; d < num_d; ++d) {
-		cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+		cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
 		cl_assert(patch && delta);
 
-		num_h = git_diff_patch_num_hunks(patch);
+		num_h = git_patch_num_hunks(patch);
 		for (h = 0; h < num_h; h++) {
-			cl_git_pass(git_diff_patch_get_hunk(
+			cl_git_pass(git_patch_get_hunk(
 				&range, &header, &header_len, &num_l, patch, h));
 
 			for (l = 0; l < num_l; ++l) {
-				cl_git_pass(git_diff_patch_get_line_in_hunk(
+				cl_git_pass(git_patch_get_line_in_hunk(
 					&origin, &line, &line_len, NULL, NULL, patch, h, l));
 				cl_assert(line);
 			}
 
-			cl_git_fail(git_diff_patch_get_line_in_hunk(
+			cl_git_fail(git_patch_get_line_in_hunk(
 				&origin, &line, &line_len, NULL, NULL, patch, h, num_l));
 		}
 
-		cl_git_fail(git_diff_patch_get_hunk(
+		cl_git_fail(git_patch_get_hunk(
 			&range, &header, &header_len, &num_l, patch, num_h));
 
-		git_diff_patch_free(patch);
+		git_patch_free(patch);
 	}
 
-	cl_git_fail(git_diff_get_patch(&patch, &delta, diff, num_d));
+	cl_git_fail(git_patch_from_diff(&patch, &delta, diff, num_d));
 
 	cl_assert_equal_i(2, (int)num_d);
 }
@@ -487,7 +487,7 @@ void test_diff_tree__diff_configs(void)
 	cl_assert_equal_i(7, expect.line_adds);
 	cl_assert_equal_i(15, expect.line_dels);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	set_config_int(g_repo, "diff.context", 1);
@@ -507,7 +507,7 @@ void test_diff_tree__diff_configs(void)
 	cl_assert_equal_i(7, expect.line_adds);
 	cl_assert_equal_i(15, expect.line_dels);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	set_config_int(g_repo, "diff.context", 0);
diff --git a/tests-clar/diff/workdir.c b/tests-clar/diff/workdir.c
index aeef7b9..4af6671 100644
--- a/tests-clar/diff/workdir.c
+++ b/tests-clar/diff/workdir.c
@@ -16,7 +16,7 @@ void test_diff_workdir__cleanup(void)
 void test_diff_workdir__to_index(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	int use_iterator;
 
@@ -60,7 +60,7 @@ void test_diff_workdir__to_index(void)
 		cl_assert_equal_i(5, exp.line_dels);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_workdir__to_tree(void)
@@ -70,8 +70,8 @@ void test_diff_workdir__to_tree(void)
 	const char *b_commit = "0017bd4ab1ec3"; /* the start */
 	git_tree *a, *b;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
-	git_diff_list *diff2 = NULL;
+	git_diff *diff = NULL;
+	git_diff *diff2 = NULL;
 	diff_expects exp;
 	int use_iterator;
 
@@ -119,7 +119,7 @@ void test_diff_workdir__to_tree(void)
 	 * do more apples-to-apples test comparison below.
 	 */
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 	memset(&exp, 0, sizeof(exp));
 
@@ -130,7 +130,7 @@ void test_diff_workdir__to_tree(void)
 	cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts));
 	cl_git_pass(git_diff_index_to_workdir(&diff2, g_repo, NULL, &opts));
 	cl_git_pass(git_diff_merge(diff, diff2));
-	git_diff_list_free(diff2);
+	git_diff_free(diff2);
 
 	for (use_iterator = 0; use_iterator <= 1; use_iterator++) {
 		memset(&exp, 0, sizeof(exp));
@@ -157,7 +157,7 @@ void test_diff_workdir__to_tree(void)
 		cl_assert_equal_i(5, exp.line_dels);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 	memset(&exp, 0, sizeof(exp));
 
@@ -167,7 +167,7 @@ void test_diff_workdir__to_tree(void)
 	cl_git_pass(git_diff_tree_to_index(&diff, g_repo, b, NULL, &opts));
 	cl_git_pass(git_diff_index_to_workdir(&diff2, g_repo, NULL, &opts));
 	cl_git_pass(git_diff_merge(diff, diff2));
-	git_diff_list_free(diff2);
+	git_diff_free(diff2);
 
 	for (use_iterator = 0; use_iterator <= 1; use_iterator++) {
 		memset(&exp, 0, sizeof(exp));
@@ -194,7 +194,7 @@ void test_diff_workdir__to_tree(void)
 		cl_assert_equal_i(4, exp.line_dels);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_tree_free(a);
 	git_tree_free(b);
@@ -203,7 +203,7 @@ void test_diff_workdir__to_tree(void)
 void test_diff_workdir__to_index_with_pathspec(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	char *pathspec = NULL;
 	int use_iterator;
@@ -235,7 +235,7 @@ void test_diff_workdir__to_index_with_pathspec(void)
 		cl_assert_equal_i(4, exp.file_status[GIT_DELTA_UNTRACKED]);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	pathspec = "modified_file";
 
@@ -258,7 +258,7 @@ void test_diff_workdir__to_index_with_pathspec(void)
 		cl_assert_equal_i(0, exp.file_status[GIT_DELTA_UNTRACKED]);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	pathspec = "subdir";
 
@@ -281,7 +281,7 @@ void test_diff_workdir__to_index_with_pathspec(void)
 		cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	pathspec = "*_deleted";
 
@@ -304,12 +304,12 @@ void test_diff_workdir__to_index_with_pathspec(void)
 		cl_assert_equal_i(0, exp.file_status[GIT_DELTA_UNTRACKED]);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_workdir__filemode_changes(void)
 {
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	int use_iterator;
 
@@ -339,7 +339,7 @@ void test_diff_workdir__filemode_changes(void)
 		cl_assert_equal_i(0, exp.hunks);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* chmod file and test again */
 
@@ -362,14 +362,14 @@ void test_diff_workdir__filemode_changes(void)
 		cl_assert_equal_i(0, exp.hunks);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_assert(cl_toggle_filemode("issue_592/a.txt"));
 }
 
 void test_diff_workdir__filemode_changes_with_filemode_false(void)
 {
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 
 	if (!cl_is_chmod_supported())
@@ -391,7 +391,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
 	cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
 	cl_assert_equal_i(0, exp.hunks);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* chmod file and test again */
 
@@ -407,7 +407,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
 	cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
 	cl_assert_equal_i(0, exp.hunks);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_assert(cl_toggle_filemode("issue_592/a.txt"));
 }
@@ -415,7 +415,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
 void test_diff_workdir__head_index_and_workdir_all_differ(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff_i2t = NULL, *diff_w2i = NULL;
+	git_diff *diff_i2t = NULL, *diff_w2i = NULL;
 	diff_expects exp;
 	char *pathspec = "staged_changes_modified_file";
 	git_tree *tree;
@@ -504,8 +504,8 @@ void test_diff_workdir__head_index_and_workdir_all_differ(void)
 		cl_assert_equal_i(0, exp.line_dels);
 	}
 
-	git_diff_list_free(diff_i2t);
-	git_diff_list_free(diff_w2i);
+	git_diff_free(diff_i2t);
+	git_diff_free(diff_w2i);
 
 	git_tree_free(tree);
 }
@@ -513,7 +513,7 @@ void test_diff_workdir__head_index_and_workdir_all_differ(void)
 void test_diff_workdir__eof_newline_changes(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	char *pathspec = "current_file";
 	int use_iterator;
@@ -546,7 +546,7 @@ void test_diff_workdir__eof_newline_changes(void)
 		cl_assert_equal_i(0, exp.line_dels);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_append2file("status/current_file", "\n");
 
@@ -573,7 +573,7 @@ void test_diff_workdir__eof_newline_changes(void)
 		cl_assert_equal_i(0, exp.line_dels);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_git_rewritefile("status/current_file", "current_file");
 
@@ -600,7 +600,7 @@ void test_diff_workdir__eof_newline_changes(void)
 		cl_assert_equal_i(2, exp.line_dels);
 	}
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 /* PREPARATION OF TEST DATA
@@ -684,9 +684,9 @@ void test_diff_workdir__larger_hunks(void)
 	opts.interhunk_lines = 0;
 
 	for (i = 0; i <= 2; ++i) {
-		git_diff_list *diff = NULL;
-		git_diff_patch *patch;
-		const git_diff_range *range;
+		git_diff *diff = NULL;
+		git_patch *patch;
+		const git_diff_hunk *range;
 		const char *header, *line;
 		char origin;
 
@@ -707,33 +707,33 @@ void test_diff_workdir__larger_hunks(void)
 		cl_assert_equal_i(2, (int)num_d);
 
 		for (d = 0; d < num_d; ++d) {
-			cl_git_pass(git_diff_get_patch(&patch, NULL, diff, d));
+			cl_git_pass(git_patch_from_diff(&patch, NULL, diff, d));
 			cl_assert(patch);
 
-			num_h = git_diff_patch_num_hunks(patch);
+			num_h = git_patch_num_hunks(patch);
 			for (h = 0; h < num_h; h++) {
-				cl_git_pass(git_diff_patch_get_hunk(
+				cl_git_pass(git_patch_get_hunk(
 					&range, &header, &header_len, &num_l, patch, h));
 
 				for (l = 0; l < num_l; ++l) {
-					cl_git_pass(git_diff_patch_get_line_in_hunk(
+					cl_git_pass(git_patch_get_line_in_hunk(
 						&origin, &line, &line_len, NULL, NULL, patch, h, l));
 					cl_assert(line);
 				}
 
 				/* confirm fail after the last item */
-				cl_git_fail(git_diff_patch_get_line_in_hunk(
+				cl_git_fail(git_patch_get_line_in_hunk(
 					&origin, &line, &line_len, NULL, NULL, patch, h, num_l));
 			}
 
 			/* confirm fail after the last item */
-			cl_git_fail(git_diff_patch_get_hunk(
+			cl_git_fail(git_patch_get_hunk(
 				&range, &header, &header_len, &num_l, patch, num_h));
 
-			git_diff_patch_free(patch);
+			git_patch_free(patch);
 		}
 
-		git_diff_list_free(diff);
+		git_diff_free(diff);
 	}
 
 	git_tree_free(a);
@@ -758,7 +758,7 @@ void test_diff_workdir__submodules(void)
 	const char *a_commit = "873585b94bdeabccea991ea5e3ec1a277895b698";
 	git_tree *a;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 
 	g_repo = setup_fixture_submod2();
@@ -819,14 +819,14 @@ void test_diff_workdir__submodules(void)
 	cl_assert_equal_i(30, exp.line_adds);
 	cl_assert_equal_i(1, exp.line_dels);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(a);
 }
 
 void test_diff_workdir__cannot_diff_against_a_bare_repository(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	git_tree *tree;
 
 	g_repo = cl_git_sandbox_init("testrepo.git");
@@ -844,7 +844,7 @@ void test_diff_workdir__cannot_diff_against_a_bare_repository(void)
 
 void test_diff_workdir__to_null_tree(void)
 {
-	git_diff_list *diff;
+	git_diff *diff;
 	diff_expects exp;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 
@@ -862,12 +862,12 @@ void test_diff_workdir__to_null_tree(void)
 
 	cl_assert_equal_i(exp.files, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_workdir__checks_options_version(void)
 {
-	git_diff_list *diff;
+	git_diff *diff;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	const git_error *err;
 
@@ -887,11 +887,11 @@ void test_diff_workdir__checks_options_version(void)
 
 void test_diff_workdir__can_diff_empty_file(void)
 {
-	git_diff_list *diff;
+	git_diff *diff;
 	git_tree *tree;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
 	struct stat st;
-	git_diff_patch *patch;
+	git_patch *patch;
 
 	g_repo = cl_git_sandbox_init("attr_index");
 
@@ -901,7 +901,7 @@ void test_diff_workdir__can_diff_empty_file(void)
 
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
 	cl_assert_equal_i(2, (int)git_diff_num_deltas(diff));
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* empty contents of file */
 
@@ -912,9 +912,9 @@ void test_diff_workdir__can_diff_empty_file(void)
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
 	cl_assert_equal_i(3, (int)git_diff_num_deltas(diff));
 	/* diffs are: .gitattributes, README.txt, sub/sub/.gitattributes */
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 1));
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 1));
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	/* remove a file altogether */
 
@@ -923,9 +923,9 @@ void test_diff_workdir__can_diff_empty_file(void)
 
 	cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
 	cl_assert_equal_i(3, (int)git_diff_num_deltas(diff));
-	cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 1));
-	git_diff_patch_free(patch);
-	git_diff_list_free(diff);
+	cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 1));
+	git_patch_free(patch);
+	git_diff_free(diff);
 
 	git_tree_free(tree);
 }
@@ -933,7 +933,7 @@ void test_diff_workdir__can_diff_empty_file(void)
 void test_diff_workdir__to_index_issue_1397(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 
 	g_repo = cl_git_sandbox_init("issue_1397");
@@ -953,7 +953,7 @@ void test_diff_workdir__to_index_issue_1397(void)
 	cl_assert_equal_i(0, exp.hunks);
 	cl_assert_equal_i(0, exp.lines);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	cl_git_rewritefile("issue_1397/crlf_file.txt",
@@ -975,7 +975,7 @@ void test_diff_workdir__to_index_issue_1397(void)
 	cl_assert_equal_i(1, exp.line_adds);
 	cl_assert_equal_i(1, exp.line_dels);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_workdir__to_tree_issue_1397(void)
@@ -983,8 +983,8 @@ void test_diff_workdir__to_tree_issue_1397(void)
 	const char *a_commit = "7f483a738"; /* the current HEAD */
 	git_tree *a;
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
-	git_diff_list *diff2 = NULL;
+	git_diff *diff = NULL;
+	git_diff *diff2 = NULL;
 	diff_expects exp;
 
 	g_repo = cl_git_sandbox_init("issue_1397");
@@ -1006,13 +1006,13 @@ void test_diff_workdir__to_tree_issue_1397(void)
 	cl_assert_equal_i(0, exp.hunks);
 	cl_assert_equal_i(0, exp.lines);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	diff = NULL;
 
 	cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts));
 	cl_git_pass(git_diff_index_to_workdir(&diff2, g_repo, NULL, &opts));
 	cl_git_pass(git_diff_merge(diff, diff2));
-	git_diff_list_free(diff2);
+	git_diff_free(diff2);
 
 	memset(&exp, 0, sizeof(exp));
 	cl_git_pass(git_diff_foreach(
@@ -1022,14 +1022,14 @@ void test_diff_workdir__to_tree_issue_1397(void)
 	cl_assert_equal_i(0, exp.hunks);
 	cl_assert_equal_i(0, exp.lines);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 	git_tree_free(a);
 }
 
 void test_diff_workdir__untracked_directory_scenarios(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	char *pathspec = NULL;
 	static const char *files0[] = {
@@ -1079,7 +1079,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* empty directory */
 
@@ -1099,7 +1099,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* empty directory in empty directory */
 
@@ -1119,7 +1119,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* directory with only ignored files */
 
@@ -1143,7 +1143,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* directory with ignored directory (contents irrelevant) */
 
@@ -1166,7 +1166,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* quick version avoids directory scan */
 
@@ -1186,7 +1186,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* directory with nested non-ignored content */
 
@@ -1209,7 +1209,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	/* use RECURSE_UNTRACKED_DIRS to get actual untracked files (no ignores) */
 
@@ -1230,14 +1230,14 @@ void test_diff_workdir__untracked_directory_scenarios(void)
 	cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
 	cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 
 void test_diff_workdir__untracked_directory_comes_last(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 
 	g_repo = cl_git_sandbox_init("renames");
 
@@ -1255,13 +1255,13 @@ void test_diff_workdir__untracked_directory_comes_last(void)
 
 	cl_assert(diff != NULL);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
 
 void test_diff_workdir__untracked_with_bom(void)
 {
 	git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	const git_diff_delta *delta;
 
 	g_repo = cl_git_sandbox_init("empty_standard_repo");
@@ -1276,9 +1276,9 @@ void test_diff_workdir__untracked_with_bom(void)
 	cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
 
 	cl_assert_equal_i(1, git_diff_num_deltas(diff));
-	cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 0));
+	cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 0));
 	cl_assert_equal_i(GIT_DELTA_UNTRACKED, delta->status);
 	cl_assert((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 }
diff --git a/tests-clar/stress/diff.c b/tests-clar/stress/diff.c
index 1d31973..3d20926 100644
--- a/tests-clar/stress/diff.c
+++ b/tests-clar/stress/diff.c
@@ -19,7 +19,7 @@ static void test_with_many(int expected_new)
 {
 	git_index *index;
 	git_tree *tree, *new_tree;
-	git_diff_list *diff = NULL;
+	git_diff *diff = NULL;
 	diff_expects exp;
 	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
 	git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -52,7 +52,7 @@ static void test_with_many(int expected_new)
 	cl_assert_equal_i(expected_new, exp.file_status[GIT_DELTA_ADDED]);
 	cl_assert_equal_i(expected_new + 1, exp.files);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	cl_repo_commit_from_index(NULL, g_repo, NULL, 1372350000, "yoyoyo");
 	cl_git_pass(git_revparse_single(
@@ -78,7 +78,7 @@ static void test_with_many(int expected_new)
 	cl_assert_equal_i(expected_new, exp.file_status[GIT_DELTA_ADDED]);
 	cl_assert_equal_i(expected_new + 1, exp.files);
 
-	git_diff_list_free(diff);
+	git_diff_free(diff);
 
 	git_tree_free(new_tree);
 	git_tree_free(tree);