Team Ai
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 21d agoView on Hugging Face
0likes1.2kdownloads
pre-push.sh68 linesDownload Raw Back to git-hooks
1#!/usr/bin/env bash2#3# Pre-push hook for llama-ui4# Runs: lint + test5# Ignores unstaged changes (stashes them temporarily and restores after).6 7needs_check=false8 9# Read refs from stdin: local_ref local_sha remote_ref remote_sha10while read local_ref local_sha remote_ref remote_sha; do11    # New branch or force-push — always check12    if [ "$local_sha" = "0000000000000000000000000000000000000000" ] || \13       [ "$remote_sha" = "0000000000000000000000000000000000000000" ]; then14        needs_check=true15        continue16    fi17 18    # Check for changes in tools/ui/ between remote and local19    if git diff --name-only "$remote_sha...$local_sha" -- tools/ui/ | grep -q .; then20        needs_check=true21    fi22done23 24if [ "$needs_check" = false ]; then25    exit 026fi27 28REPO_ROOT=$(git rev-parse --show-toplevel)29cd "$REPO_ROOT/tools/ui"30 31# Check that node_modules exists32if [ ! -d "node_modules" ]; then33    echo "❌ node_modules not found. Run 'npm ci' first."34    exit 135fi36 37# Stash unstaged changes so they don't interfere with checks38stash_name="pi-ui-prepush"39git stash push -u -m "$stash_name" -- tools/ui/ 2>/dev/null || true40 41echo "Running pre-push checks for llama-ui..."42 43# Lint44npm run lint45lint_ok=$?46 47# Test48npm test49test_ok=$?50 51# Restore stashed changes52if git stash list | grep -q "$stash_name"; then53    git stash pop 2>/dev/null || true54fi55 56if [ $lint_ok -ne 0 ]; then57    echo "❌ Lint failed"58    exit 159fi60 61if [ $test_ok -ne 0 ]; then62    echo "❌ Tests failed"63    exit 164fi65 66echo "✅ Pre-push checks passed"67exit 068