1
0
Fork 0
mirror of https://github.com/imjasonh/infinite-git synced 2026-07-12 02:41:48 +00:00
No description
Find a file
Jason Hall db0c5c91a5
Update to use single hello.txt file instead of creating new files
Instead of creating a new file for each pull (pull_1.txt, pull_2.txt, etc.),
now updates a single hello.txt file with the pull number and timestamp
with nanosecond precision.

Changes:
- Modified commit generator to update hello.txt instead of creating new files
- Added hello.txt to initial repository commit
- Updated tests to verify hello.txt content instead of checking for new files
- Fixed test expectations to account for counter increment during clone

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-23 22:56:40 -04:00
iac Deploy to Cloud Run with Terraform 2025-07-23 22:47:52 -04:00
internal Update to use single hello.txt file instead of creating new files 2025-07-23 22:56:40 -04:00
.gitignore Deploy to Cloud Run with Terraform 2025-07-23 22:47:52 -04:00
go.mod Implement pure Go Git HTTP server without CLI dependencies 2025-07-23 22:28:50 -04:00
go.sum Implement pure Go Git HTTP server without CLI dependencies 2025-07-23 22:28:50 -04:00
LICENSE Initial commit 2025-07-23 21:17:28 -04:00
main.go Implement pure Go Git HTTP server without CLI dependencies 2025-07-23 22:28:50 -04:00
main_test.go Update to use single hello.txt file instead of creating new files 2025-07-23 22:56:40 -04:00
plan.md Implement infinite Git HTTP server 2025-07-23 21:19:02 -04:00
README.md Implement pure Go Git HTTP server without CLI dependencies 2025-07-23 22:28:50 -04:00
test.sh Implement pure Go Git HTTP server without CLI dependencies 2025-07-23 22:28:50 -04:00

Infinite Git

A Git HTTP server that generates a new commit every time someone pulls from the repository.

Features

  • Implements Git smart HTTP protocol for read-only access
  • Generates a unique commit on every pull/clone operation
  • Thread-safe commit generation
  • Persistent Git repository on disk
  • Structured logging with slog

Installation

go install github.com/imjasonh/infinite-git/cmd/infinite-git@latest

Or build from source:

git clone https://github.com/imjasonh/infinite-git
cd infinite-git
go build -o infinite-git ./cmd/infinite-git

Usage

Start the server:

infinite-git

Configuration via environment variables:

  • PORT: HTTP server port (default: "8080")
  • REPO_PATH: Path to Git repository (default: "./infinite-repo")

Example:

PORT=3000 REPO_PATH=/tmp/my-infinite-repo infinite-git

Logging is configured via the standard clog environment variables.

Testing

Clone the repository:

git clone http://localhost:8080

Every time you pull, you'll get a new commit:

cd <cloned-repo>
git pull origin main
# New commit appears!

How It Works

  1. When a client initiates a pull/clone, the server intercepts the reference discovery request
  2. Before advertising refs, it generates a new commit with:
    • A unique file containing the pull counter and timestamp
    • A commit message indicating when the pull occurred
  3. The new commit is added to the main branch
  4. The updated refs are sent to the client
  5. The client receives the new commit as part of the normal Git protocol flow

Implementation Details

  • Uses Git plumbing commands (git add, git commit) to create commits
  • Implements pkt-line format for Git protocol communication
  • Delegates object transfer to git upload-pack for efficiency
  • Rejects all push attempts with 403 Forbidden

License

MIT