MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / check_or_write_asset_input_fingerprint

Function check_or_write_asset_input_fingerprint

xtask/src/main.rs:5460–5484  ·  view source on GitHub ↗
(write: bool)

Source from the content-addressed store, hash-verified

5458}
5459
5460fn check_or_write_asset_input_fingerprint(write: bool) -> Result<()> {
5461 let fingerprint = asset_input_fingerprint()?;
5462 let path = Path::new(ASSET_INPUT_FINGERPRINT_PATH);
5463 if write {
5464 if let Some(parent) = path.parent() {
5465 fs::create_dir_all(parent).with_context(|| format!("create {}", parent.display()))?;
5466 }
5467 fs::write(path, format!("{fingerprint}\n"))
5468 .with_context(|| format!("write {}", path.display()))?;
5469 println!("wrote {}", path.display());
5470 return Ok(());
5471 }
5472
5473 let expected = fs::read_to_string(path).with_context(|| {
5474 format!(
5475 "read {}; run `cargo run -p xtask -- assets input-fingerprint --write` after refreshing assets",
5476 path.display()
5477 )
5478 })?;
5479 ensure_eq(
5480 fingerprint.as_str(),
5481 expected.trim(),
5482 "committed asset input fingerprint",
5483 )
5484}
5485
5486fn asset_input_fingerprint() -> Result<String> {
5487 let tracked = command_output(

Callers 2

assetsFunction · 0.85
verify_committed_assetsFunction · 0.85

Calls 2

asset_input_fingerprintFunction · 0.85
ensure_eqFunction · 0.85

Tested by

no test coverage detected