Commit 146c7ed
committed
odb: add write_packfile, for_each_unique_abbrev, convert_object_id
Add three vtable methods to odb_source that were not part of the
recent ps/odb-sources and ps/object-counting series:
- write_packfile: ingest a pack from a file descriptor. The files
backend chooses between index-pack (large packs) and
unpack-objects (small packs below fetch.unpackLimit). Options
cover thin-pack fixing, promisor marking, fsck, lockfile
capture, and shallow file passing.
- for_each_unique_abbrev: iterate objects matching a hex prefix
for disambiguation. Searches loose objects via oidtree, then
multi-pack indices, then non-MIDX packs.
- convert_object_id: translate between hash algorithms using the
loose object map. Used during SHA-1 to SHA-256 migration.
Also add ODB_SOURCE_HELPER to the source type enum, preparing for
the helper backend in the next commit.
The write_packfile vtable method replaces the pattern where callers
spawn index-pack/unpack-objects directly. fast-import already uses
odb_write_packfile() and this allows non-files backends to handle
pack ingestion through their own mechanism.
Signed-off-by: Aaron Paterson <apaterson@pm.me>1 parent 41688c1 commit 146c7ed
5 files changed
+480
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
114 | 123 | | |
115 | 124 | | |
116 | 125 | | |
117 | 126 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
121 | 137 | | |
122 | 138 | | |
123 | 139 | | |
| |||
208 | 224 | | |
209 | 225 | | |
210 | 226 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
214 | 236 | | |
215 | 237 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
220 | 244 | | |
221 | 245 | | |
222 | 246 | | |
| |||
796 | 820 | | |
797 | 821 | | |
798 | 822 | | |
799 | | - | |
| 823 | + | |
| 824 | + | |
800 | 825 | | |
801 | | - | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
802 | 830 | | |
| 831 | + | |
| 832 | + | |
803 | 833 | | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
808 | 848 | | |
809 | 849 | | |
810 | | - | |
811 | | - | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
812 | 855 | | |
813 | 856 | | |
814 | 857 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
981 | 981 | | |
982 | 982 | | |
983 | 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 | + | |
984 | 1010 | | |
985 | 1011 | | |
986 | 1012 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
377 | 384 | | |
378 | 385 | | |
379 | 386 | | |
| |||
570 | 577 | | |
571 | 578 | | |
572 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
573 | 599 | | |
574 | 600 | | |
575 | 601 | | |
| |||
0 commit comments