1
0
Fork 0
mirror of https://github.com/imjasonh/infinite-git synced 2026-07-08 09:05:06 +00:00
infinite-git/test.sh
Jason Hall 8919cd5826
Implement pure Go Git HTTP server without CLI dependencies
Major rewrite to eliminate git CLI dependency:
- Created object package for Git object format handling (blob, tree, commit)
- Implemented packfile generation from scratch
- Rewrote repo initialization to create Git repos without CLI
- Implemented git-upload-pack protocol in pure Go
- Updated all server handlers to use new implementation
- Added Git packet tracing to test.sh for debugging
- Fixed tests to work with new implementation

The server now works entirely with Go code, no git commands needed.
Clone operations work correctly, but pull operations still have protocol
negotiation issues that need further debugging.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-23 22:28:50 -04:00

54 lines
969 B
Bash
Executable file

#!/bin/bash
set -ex
# Enable Git packet tracing for debugging
export GIT_TRACE_PACKET=1
# Cleanup function
cleanup() {
echo "Cleaning up..."
if [ -n "$SERVER_PID" ]; then
kill $SERVER_PID 2>/dev/null || true
fi
}
# Trap EXIT to ensure cleanup happens
trap cleanup EXIT
# Kill any existing server in case it was not cleaned up
lsof -ti:9876 | xargs kill -9 2>/dev/null || true
echo "Starting infinite-git server..."
PORT=9876 REPO_PATH=/tmp/test-infinite-git go run . &
SERVER_PID=$!
# Give server time to start
sleep 2
# Create test directory
TEST_DIR=$(mktemp -d)
cd "$TEST_DIR"
echo "Cloning repository..."
git clone http://localhost:9876 test-repo
cd test-repo
echo "Initial clone complete. Files:"
ls -la
echo "Pulling again..."
git pull
echo "Files after first pull:"
ls -la
echo "Pulling once more..."
git pull
echo "Files after second pull:"
ls -la
echo "Checking commits..."
git --no-pager log --oneline
echo "Test complete!"