Commit 785108f
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 785108f
5 files changed
+458
-12
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 | | |
| |||
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
118 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
| 124 | + | |
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| |||
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
| |||
796 | 804 | | |
797 | 805 | | |
798 | 806 | | |
799 | | - | |
| 807 | + | |
| 808 | + | |
800 | 809 | | |
801 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
802 | 814 | | |
| 815 | + | |
| 816 | + | |
803 | 817 | | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
808 | 832 | | |
809 | 833 | | |
810 | | - | |
811 | | - | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
812 | 839 | | |
813 | 840 | | |
814 | 841 | | |
| |||
| 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