in focus/operations/src/detect_build_graph_changes.rs [17:43]
fn find_committed_changes(app: Arc<App>, repo_path: &Path) -> Result<Vec<PathBuf>> {
let repo = Repo::open(repo_path, app.clone())?;
let working_tree = repo.working_tree()?;
let sync_state_oid = {
if let Some(sync_point) = working_tree
.read_sparse_sync_point_ref()
.context("reading sync state")?
{
sync_point
} else {
bail!("No sync state!");
}
};
let revspec = format!("{}..HEAD", &sync_state_oid);
let output =
git_helper::run_consuming_stdout(repo_path, ["diff", "--name-only", &revspec], app)?;
let mut build_involved_changed_paths = Vec::<PathBuf>::new();
for line in output.lines() {
let parsed = PathBuf::from(line);
if paths::is_relevant_to_build_graph(parsed.as_path()) {
info!(path = ?parsed, "Committed path");
build_involved_changed_paths.push(parsed);
}
}
Ok(build_involved_changed_paths)
}