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:
File diff suppressed because one or more lines are too long
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user