pub(crate) fn resolve_hash_type(
repo_path: &Path,
cli_hash: Option<HashType>,
upgrade: bool,
) -> Result<HashType>Expand description
Determine the effective hash type for a repository.
Resolution order:
- If
meta.jsonexists, use its algorithm. Error if--hashwas explicitly passed and conflicts. - If no metadata and
upgradeis true, infer from existing objects. - If no metadata and
upgradeis false, error.
Note: we read the metadata file directly here (rather than via
Repository::metadata) because this runs before we know which
generic ObjectID type to use — that’s exactly what we’re deciding.