Function looks_like_object_id

Source
fn looks_like_object_id(value: &str) -> bool
Expand description

Whether a cell could be a git object id.

Deliberately permissive about length so an abbreviated hash still matches — this decides what is already recorded, and a false negative would append a duplicate row, which is the one outcome that matters.

There is a floor and no ceiling, on purpose. A ceiling of 40 reads as correct against SHA-1 and encodes an assumption this function has no reason to make: a SHA-256 repository writes 64-character ids, none of which would match. The floor alone already excludes the table header and the |---| rule, which is all a bound was ever there to do.

Measured rather than asserted, because the obvious reading overstates it: the git2 this crate builds against refuses to open a SHA-256 repository at all (unknown object format 'sha256'), so the duplicate-for-ever outcome is not reachable today. The ceiling protected nothing, so removing it costs nothing and stops the assumption outliving the reason for it.