mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-01 01:10:46 +08:00
commit: use read_header
The `Odb::reader` method states:
Note that most backends do not support streaming reads because
they store their objects as compressed/delta’ed blobs. If the
backend does not support streaming reads, use the read method
instead.
This can lead to objects not being found when verifying for
commits. Instead use `read_header` to determine the `ObjectType` of
the `Oid`.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -149,8 +149,8 @@ impl Commit {
|
||||
fn verify_object(odb: &git2::Odb, oid: &Oid, expected: ObjectType) -> Result<(), error::Write> {
|
||||
use git2::{Error, ErrorClass, ErrorCode};
|
||||
|
||||
let (_, _, kind) = odb
|
||||
.reader(*oid)
|
||||
let (_, kind) = odb
|
||||
.read_header(*oid)
|
||||
.map_err(|err| error::Write::OdbRead { oid: *oid, err })?;
|
||||
if kind != expected {
|
||||
Err(error::Write::NotCommit {
|
||||
|
||||
Reference in New Issue
Block a user