Skip to content

Commit 02587fc

Browse files
committed
refactor and fixes
1 parent 8c41848 commit 02587fc

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

gix-object/src/tree/ref_iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ mod decode {
144144
let mode = tree::EntryMode::try_from(mode).ok()?;
145145
let (filename, i) = i.split_at(i.find_byte(0)?);
146146
let i = &i[1..];
147-
const HASH_LEN_FIXME: usize = 20; // TODO: know actual /desired length or we may overshoot
147+
const HASH_LEN_FIXME: usize = 20; // TODO(SHA256): know actual/desired length or we may overshoot
148148
let (oid, i) = match i.len() {
149149
len if len < HASH_LEN_FIXME => return None,
150150
_ => i.split_at(20),
@@ -164,7 +164,7 @@ mod decode {
164164
terminated(take_while(5..=6, AsChar::is_dec_digit), SPACE)
165165
.verify_map(|mode| tree::EntryMode::try_from(mode).ok()),
166166
terminated(take_while(1.., |b| b != NULL[0]), NULL),
167-
take(20u8),
167+
take(20u8), // TODO(SHA256): make this compatible with other hash lengths
168168
)
169169
.map(|(mode, filename, oid): (_, &[u8], _)| EntryRef {
170170
mode,

tests/tools/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub use once_cell;
1919
use once_cell::sync::Lazy;
2020
use parking_lot::Mutex;
2121
pub use tempfile;
22-
use winnow::error::TreeError;
2322

2423
/// A result type to allow using the try operator `?` in unit tests.
2524
///
@@ -691,10 +690,10 @@ fn extract_archive(
691690
Ok((archive_identity, platform))
692691
}
693692

694-
/// Transform a verbose bom errors from raw bytes into a `BStr` to make printing/debugging human-readable.
693+
/// Transform a verbose parser errors from raw bytes into a `BStr` to make printing/debugging human-readable.
695694
pub fn to_bstr_err(
696-
err: winnow::error::ErrMode<TreeError<&[u8], winnow::error::StrContext>>,
697-
) -> TreeError<&BStr, winnow::error::StrContext> {
695+
err: winnow::error::ErrMode<winnow::error::TreeError<&[u8], winnow::error::StrContext>>,
696+
) -> winnow::error::TreeError<&BStr, winnow::error::StrContext> {
698697
let err = err.into_inner().expect("not a streaming parser");
699698
err.map_input(ByteSlice::as_bstr)
700699
}

0 commit comments

Comments
 (0)