forked from ProverCoderAI/docker-git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-pre-commit-ai-dirs.sh
More file actions
executable file
·49 lines (40 loc) · 1.36 KB
/
test-pre-commit-ai-dirs.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
set -euo pipefail
# Test that the pre-commit hook logic correctly stages AI config directories
echo "=== Testing AI directory auto-staging logic ==="
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT"
# Create test AI directories with test files
for ai_dir in .gemini .claude .codex; do
mkdir -p "$ai_dir"
echo "test-content-$(date +%s)" > "$ai_dir/test-file.txt"
done
echo "Created test files:"
ls -la .gemini/test-file.txt .claude/test-file.txt .codex/test-file.txt
# Check gitignore status
echo ""
echo "=== Checking gitignore status ==="
for ai_dir in .gemini .claude .codex; do
if git check-ignore -q "$ai_dir/test-file.txt" 2>/dev/null; then
echo "IGNORED: $ai_dir (this is a problem!)"
else
echo "NOT IGNORED: $ai_dir (good - can be tracked)"
fi
done
# Simulate the auto-staging logic from the pre-commit hook
echo ""
echo "=== Simulating auto-staging ==="
for ai_dir in .gemini .claude .codex; do
if [ -d "$ai_dir" ]; then
git add -A -- "$ai_dir"
echo "Staged: $ai_dir"
fi
done
echo ""
echo "=== Staged files ==="
git diff --cached --name-only | grep -E "^\.(gemini|claude|codex)/" || echo "(none found)"
# Clean up - unstage the test files
git reset HEAD -- .gemini .claude .codex 2>/dev/null || true
rm -rf .gemini/test-file.txt .claude/test-file.txt .codex/test-file.txt
echo ""
echo "=== Test complete ==="