Skip to main content

identities

Function identities 

Source
pub fn identities(root: &Path) -> Vec<IdentityFacet>
Expand description

How this checkout spells each of the identities the audit found conflated, beside the canonical value this executable computes.

The point is not to choose a winner. It is to stop pretending the spellings are one value: a reader that knows a string is the local spelling can compare it with other local spellings and refuse to compare it with a shared one, which is exactly the comparison that made two records of one repository, written four minutes apart, look like records of two repositories.

use majordomus_cli::session::identities;

let dir = tempfile::tempdir().unwrap();
let facets = identities(dir.path());
let subjects: Vec<&str> = facets.iter().map(|f| f.subject.as_str()).collect();
assert_eq!(subjects, ["repository", "checkout", "episode", "provider_session"]);

// a plain directory belongs to no git repository, and that is reported as absence
assert!(facets[0].canonical.is_empty());
// a checkout always has an identity: the question has to be answerable for a record
// written on a disk that has since been unmounted
assert_eq!(facets[1].canonical.len(), 32);