Skip to main content

derived_among

Function derived_among 

Source
pub fn derived_among(root: &Path, paths: &[String]) -> Vec<String>
Expand description

Which of paths this repository declares derived, asked of git rather than parsed.

.gitattributes marks every generated file merge=derived, and git check-attr is the reader that already understands its precedence, its globs and its negations. A second parser here would be a second opinion about which files are generated, which is the class of defect this repository spends its time removing — and one that has already cost it once, when a hand-written glob claimed forty-five files of which the generator writes nine.

use majordomus_cli::commit::plan::derived_among;
let plain = tempfile::tempdir().expect("a temporary directory");
// nothing to ask about is nothing derived, and git is never run
assert!(derived_among(plain.path(), &[]).is_empty());