huskies: merge 1065

This commit is contained in:
dave
2026-05-14 21:43:13 +00:00
parent e6865a1bc6
commit 23c3301903
3 changed files with 154 additions and 87 deletions
+48
View File
@@ -361,6 +361,54 @@ pub(crate) fn run_squash_merge(
"=== Verified: cherry-pick landed on '{base_branch}' with code changes ===\n"
));
// ── Regen source-map.json on master after cherry-pick ─────────
// Run deterministically on project_root (now on master). Skip the commit
// when regen produces no diff (idempotent case). Failure is non-fatal.
{
let map_path = project_root.join(".huskies").join("source-map.json");
let old_content = std::fs::read_to_string(&map_path).ok();
match source_map_gen::regenerate_source_map(project_root, &map_path) {
Err(e) => {
all_output.push_str(&format!(
"=== source-map regen failed (non-fatal): {e} ===\n"
));
}
Ok(()) => {
let new_content = std::fs::read_to_string(&map_path).ok();
if old_content != new_content {
all_output.push_str("=== source-map.json changed — committing on master ===\n");
let _ = Command::new("git")
.args(["add", ".huskies/source-map.json"])
.current_dir(project_root)
.output();
match Command::new("git")
.args(["commit", "-m", "huskies: regen source-map.json"])
.current_dir(project_root)
.output()
{
Ok(c) if c.status.success() => {
all_output.push_str("=== source-map.json committed on master ===\n");
}
Ok(c) => {
let stderr = String::from_utf8_lossy(&c.stderr);
all_output.push_str(&format!(
"=== source-map commit failed (non-fatal): {stderr} ===\n"
));
}
Err(e) => {
all_output.push_str(&format!(
"=== source-map commit error (non-fatal): {e} ===\n"
));
}
}
} else {
all_output
.push_str("=== source-map.json unchanged — no follow-up commit ===\n");
}
}
}
}
// ── Clean up ──────────────────────────────────────────────────
cleanup_merge_workspace(project_root, &merge_wt_path, &merge_branch);
all_output.push_str("=== Merge-queue cleanup complete ===\n");