Skip to content

Commit 97ea52b

Browse files
authored
fix(hooks): guard strings/cat against set -e abort in pre-push (#177)
Add || echo "" fallback to strings and cat command substitutions. Without this, if strings is not installed (e.g. minimal Docker/CI images), set -e silently aborts the script with exit 127, blocking the push with no message.
1 parent 775f265 commit 97ea52b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.git-hooks/pre-push

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ while read local_ref local_sha remote_ref remote_sha; do
134134
fi
135135

136136
if [ "$is_binary" = true ]; then
137-
file_text=$(strings "$file" 2>/dev/null)
137+
file_text=$(strings "$file" 2>/dev/null || echo "")
138138
else
139-
file_text=$(cat "$file" 2>/dev/null)
139+
file_text=$(cat "$file" 2>/dev/null || echo "")
140140
fi
141141

142142
# Check for hardcoded user paths.

0 commit comments

Comments
 (0)