PRE_COMMIT_HOOK

Constant PRE_COMMIT_HOOK 

Source
pub const PRE_COMMIT_HOOK: &str = r#"#!/bin/sh
# Sigil lint pre-commit hook
# Generated by sigil lint --generate-hook

# Get list of staged .sigil files
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.sigil$')

if [ -z "$STAGED_FILES" ]; then
    exit 0
fi

echo "Running Sigil linter on staged files..."

# Run linter on staged files
RESULT=0
for FILE in $STAGED_FILES; do
    if [ -f "$FILE" ]; then
        sigil lint "$FILE"
        if [ $? -ne 0 ]; then
            RESULT=1
        fi
    fi
done

if [ $RESULT -ne 0 ]; then
    echo ""
    echo "Commit blocked: Please fix lint errors before committing."
    echo "Use 'git commit --no-verify' to bypass (not recommended)."
    exit 1
fi

exit 0
"#;
Expand description

Pre-commit hook script content.