Repository navigation
Tie Indexer to the Odb borrow - #1353
Conversation
| progress: raw::git_indexer_progress, | ||
| progress_payload_ptr: *mut OdbPackwriterCb<'odb>, | ||
| // libgit2's git_indexer stores a bare git_odb pointer (it does not addref | ||
| // it), so keep the Rust borrow alive for as long as the indexer exists. |
There was a problem hiding this comment.
this documentation suggests that the Odb should never be None - but it can be None, can you document why that isn't an issue?
Agreed with this |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Added docs explaining why |
| /// rejected when [`Indexer::commit`] resolves the pending deltas, with | ||
| /// "cannot fix a thin pack without an ODB". | ||
| /// | ||
| /// When `verify` is enabled, connectivity is still checked. An object |
There was a problem hiding this comment.
on L126 it also talks about verify. Can you consolidate them?
This comment has been minimized.
This comment has been minimized.
fbed875 to
100f89f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
git_indexer_newkeeps the supplied ODB pointer without taking a reference. AnIndexercould previously outlive theOdbvalue and later dereference freed memory when verifying connectivity or fixing a thin pack.Store
Option<&'odb Odb<'odb>>inIndexer<'odb>and borrow the ODB inIndexer::new/new_ext. Add compile-fail regressions for borrowing a temporary ODB (E0716) and dropping a borrowed ODB before the indexer (E0505).Clarify that
Noneis accepted by libgit2. Thin packs requiring an external delta base fail duringIndexer::commit, rather thanwrite. With verification enabled, connectivity checks still run and missing referenced objects cannot be satisfied from an external ODB.Fixes #1352.
Validation
Validated after merging main at
2ea0217(libgit2 2.0.0-rc.1):cargo +stable test --lockedcargo +stable test --locked --features https,sshcargo +stable test --locked -p git2-curlcargo +stable run --locked -p systestcargo +stable fmt --checkcargo +stable clippy --locked --all-targets --all-features -- -DwarningsThe stable compile-fail suite retains all upstream cases and both new Indexer regressions. Existing SHA-1 and SHA-256 Indexer tests cover valid ODB borrows.