Skip to content

Commit 4e29098

Browse files
committed
fix: skip binary files in personal path detection
1 parent f2383d8 commit 4e29098

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.git-hooks/pre-push

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ while read local_ref local_sha remote_ref remote_sha; do
154154
file_text=$(cat "$file" 2>/dev/null)
155155
fi
156156

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

0 commit comments

Comments
 (0)