Skip to main content

of_root_commits

Function of_root_commits 

Source
pub fn of_root_commits(roots: &[String]) -> MeshRepositoryIdentity
Expand description

The identity a set of root commits yields. The roots are treated as a set rather than a list, because git rev-list makes no promise about the order it prints them in and two machines that disagreed about that order would decide they held different repositories; for the same reason the same root named twice is one root.

use majordomus_cli::mesh::repository::of_root_commits;

let a = of_root_commits(&["b".repeat(40), "a".repeat(40)]);
let b = of_root_commits(&["a".repeat(40), "b".repeat(40), "a".repeat(40)]);
assert_eq!(a.id, b.id, "a set: order and repetition are not information");
assert_ne!(a.id, of_root_commits(&["a".repeat(40)]).id);