Skip to content

Commit 0b29a5f

Browse files
authored
fix(hooks): guard strings/cat against set -e abort in pre-push (#59)
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 0396fda commit 0b29a5f

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
@@ -128,9 +128,9 @@ while read local_ref local_sha remote_ref remote_sha; do
128128
fi
129129

130130
if [ "$is_binary" = true ]; then
131-
file_text=$(strings "$file" 2>/dev/null)
131+
file_text=$(strings "$file" 2>/dev/null || echo "")
132132
else
133-
file_text=$(cat "$file" 2>/dev/null)
133+
file_text=$(cat "$file" 2>/dev/null || echo "")
134134
fi
135135

136136
# Check for hardcoded user paths.

0 commit comments

Comments
 (0)