From 24e27f6e879899f83bd21fa78b916726ad1bfa46 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Thu, 4 May 2023 17:27:47 +0100 Subject: [PATCH] commit: use read_header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 X-Clacks-Overhead: GNU Terry Pratchett --- radicle-git-ext/src/commit.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radicle-git-ext/src/commit.rs b/radicle-git-ext/src/commit.rs index dbd51c9..9eaf772 100644 --- a/radicle-git-ext/src/commit.rs +++ b/radicle-git-ext/src/commit.rs @@ -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 {