Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: skip binary files in personal path detection
  • Loading branch information
jdalton committed Apr 15, 2026
commit 05688cc0784eafe53f6ead932049b14aea67281b
5 changes: 3 additions & 2 deletions .git-hooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ while read local_ref local_sha remote_ref remote_sha; do
file_text=$(cat "$file" 2>/dev/null)
fi

# Hardcoded personal paths (/Users/foo/, /home/foo/, C:\Users\foo\).
if echo "$file_text" | grep -qE '(/Users/[^/\s]+/|/home/[^/\s]+/|C:\\Users\\[^\\]+\\)'; then
# Hardcoded personal paths (/Users/foo/, /home/foo/, C:\\Users\\foo\\).
# Skip binary files — compiled binaries contain build-machine paths.
if [ "$is_binary" = false ] && echo "$file_text" | grep -qE '(/Users/[^/\s]+/|/home/[^/\s]+/|C:\\Users\\[^\\]+\\)'; then
printf "${RED}✗ BLOCKED: Hardcoded personal path found in: %s${NC}\n" "$file"
echo "$file_text" | grep -nE '(/Users/[^/\s]+/|/home/[^/\s]+/|C:\\Users\\[^\\]+\\)' | head -3
ERRORS=$((ERRORS + 1))
Expand Down