Fix bd-fwul: Add executable bit validation for git hooks

Added validation to hooksInstalled() to check if hook files have the
executable bit set. Previously we only checked for file existence and
marker strings, which meant hooks could appear installed but fail
silently if they weren't executable.

The fix adds Mode().Perm() & 0111 checks for both pre-commit and
post-merge hooks after verifying their content.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-23 21:48:54 -08:00
parent cf84eb85e1
commit 1c715bc61c
2 changed files with 202 additions and 185 deletions

File diff suppressed because one or more lines are too long

View File

@@ -421,6 +421,23 @@ func hooksInstalled() bool {
return false
}
// Verify hooks are executable
preCommitInfo, err := os.Stat(preCommit)
if err != nil {
return false
}
if preCommitInfo.Mode().Perm()&0111 == 0 {
return false // Not executable
}
postMergeInfo, err := os.Stat(postMerge)
if err != nil {
return false
}
if postMergeInfo.Mode().Perm()&0111 == 0 {
return false // Not executable
}
return true
}