Commit 8a6ac28
builtin/commit-graph.c: introduce split strategy 'replace'
When using split commit-graphs, it is sometimes useful to completely
replace the commit-graph chain with a new base.
For example, consider a scenario in which a repository builds a new
commit-graph incremental for each push. Occasionally (say, after some
fixed number of pushes), they may wish to rebuild the commit-graph chain
with all reachable commits.
They can do so with
$ git commit-graph write --reachable
but this removes the chain entirely and replaces it with a single
commit-graph in 'objects/info/commit-graph'. Unfortunately, this means
that the next push will have to move this commit-graph into the first
layer of a new chain, and then write its new commits on top.
Avoid such copying entirely by allowing the caller to specify that they
wish to replace the entirety of their commit-graph chain, while also
specifying that the new commit-graph should become the basis of a fresh,
length-one chain.
This addresses the above situation by making it possible for the caller
to instead write:
$ git commit-graph write --reachable --split=replace
which writes a new length-one chain to 'objects/info/commit-graphs',
making the commit-graph incremental generated by the subsequent push
relatively cheap by avoiding the aforementioned copy.
In order to do this, remove an assumption in 'write_commit_graph_file'
that chains are always at least two incrementals long.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent fdbde82 commit 8a6ac28
File tree
5 files changed
+66
-18
lines changed- Documentation
- builtin
- t
5 files changed
+66
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
866 | 866 | | |
867 | 867 | | |
868 | 868 | | |
869 | | - | |
| 869 | + | |
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
| |||
897 | 897 | | |
898 | 898 | | |
899 | 899 | | |
900 | | - | |
| 900 | + | |
901 | 901 | | |
902 | 902 | | |
903 | 903 | | |
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
967 | | - | |
| 967 | + | |
968 | 968 | | |
969 | 969 | | |
970 | 970 | | |
| |||
1037 | 1037 | | |
1038 | 1038 | | |
1039 | 1039 | | |
| 1040 | + | |
| 1041 | + | |
1040 | 1042 | | |
1041 | 1043 | | |
1042 | 1044 | | |
| |||
1066 | 1068 | | |
1067 | 1069 | | |
1068 | 1070 | | |
1069 | | - | |
1070 | | - | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
1071 | 1074 | | |
1072 | 1075 | | |
1073 | 1076 | | |
| |||
1287 | 1290 | | |
1288 | 1291 | | |
1289 | 1292 | | |
| 1293 | + | |
| 1294 | + | |
1290 | 1295 | | |
1291 | 1296 | | |
1292 | 1297 | | |
| |||
1303 | 1308 | | |
1304 | 1309 | | |
1305 | 1310 | | |
1306 | | - | |
| 1311 | + | |
1307 | 1312 | | |
1308 | 1313 | | |
1309 | 1314 | | |
1310 | | - | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
1311 | 1319 | | |
1312 | 1320 | | |
1313 | 1321 | | |
| |||
1488 | 1496 | | |
1489 | 1497 | | |
1490 | 1498 | | |
1491 | | - | |
1492 | | - | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
1493 | 1505 | | |
1494 | 1506 | | |
1495 | 1507 | | |
| |||
1546 | 1558 | | |
1547 | 1559 | | |
1548 | 1560 | | |
1549 | | - | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
1550 | 1565 | | |
1551 | | - | |
| 1566 | + | |
| 1567 | + | |
1552 | 1568 | | |
1553 | 1569 | | |
1554 | 1570 | | |
| |||
1561 | 1577 | | |
1562 | 1578 | | |
1563 | 1579 | | |
1564 | | - | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1565 | 1585 | | |
1566 | 1586 | | |
1567 | 1587 | | |
| |||
1772 | 1792 | | |
1773 | 1793 | | |
1774 | 1794 | | |
| 1795 | + | |
1775 | 1796 | | |
1776 | 1797 | | |
1777 | 1798 | | |
| |||
1806 | 1827 | | |
1807 | 1828 | | |
1808 | 1829 | | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
1809 | 1833 | | |
1810 | 1834 | | |
1811 | 1835 | | |
| |||
1866 | 1890 | | |
1867 | 1891 | | |
1868 | 1892 | | |
1869 | | - | |
| 1893 | + | |
1870 | 1894 | | |
1871 | 1895 | | |
1872 | 1896 | | |
1873 | 1897 | | |
1874 | 1898 | | |
1875 | | - | |
| 1899 | + | |
| 1900 | + | |
1876 | 1901 | | |
1877 | 1902 | | |
1878 | 1903 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
358 | 377 | | |
0 commit comments