huskies: merge 1155 story Bracket logging around install_pre_commit_hook to diagnose bug 1151 freezes

This commit is contained in:
dave
2026-05-19 23:54:05 +00:00
parent 5bca1f6cec
commit e7456d3391
2 changed files with 18 additions and 0 deletions
@@ -130,11 +130,20 @@ pub(crate) async fn on_coding_transition(project_root: &Path, port: u16, story_i
info.path.display()
);
let hook_path = info.path.clone();
slog!("[worktree] starting pre-commit hook install for '{story_id}'");
let hook_result = tokio::task::spawn_blocking(move || {
crate::worktree::install_pre_commit_hook(&hook_path)
})
.await
.unwrap_or_else(|e| Err(format!("spawn_blocking panicked: {e}")));
match &hook_result {
Ok(()) => {
slog!("[worktree] finished pre-commit hook install for '{story_id}' result=ok")
}
Err(e) => slog!(
"[worktree] finished pre-commit hook install for '{story_id}' result=err: {e}"
),
}
if let Err(e) = hook_result {
slog_warn!(
"[worktree-create-sub] Pre-commit hook install failed for '{story_id}': {e}"
+9
View File
@@ -163,12 +163,21 @@ pub fn install_pre_commit_hook(wt_path: &Path) -> Result<(), String> {
// Point git at the per-worktree hooks dir so only this worktree uses
// these hooks (not the main repo or other worktrees).
slog!(
"[worktree-hook] starting git config --worktree core.hooksPath for '{}'",
wt_path.display()
);
let output = std::process::Command::new("git")
.args(["config", "--worktree", "core.hooksPath", ".git-hooks"])
.current_dir(wt_path)
.output()
.map_err(|e| format!("git config --worktree core.hooksPath: {e}"))?;
slog!(
"[worktree-hook] finished git config --worktree core.hooksPath for '{}' status={}",
wt_path.display(),
output.status
);
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
return Err(format!(