mirror of
https://github.com/imjasonh/infinite-git
synced 2026-07-08 09:05:06 +00:00
No description
- packfile.go: ReadObject now uses a countingReader to track compressed bytes consumed and properly advances r.offset, fixing sequential multi-object reads. - handlers.go: Use commitSHA from GenerateCommit directly instead of re-reading refs, which fixes both the HTTP error-after-body-written issue and ensures HEAD is always advertised first (Git protocol requirement). - commit.go: GenerateCommit now holds the repo lock for the entire read-modify-write cycle, preventing concurrent generates from reading the same parent and losing ref updates. - repo.go: Added Lock/Unlock/GetRefsLocked methods to support holding the mutex across multiple repo operations. https://claude.ai/code/session_015F9BYQoCy2P2zYZBuVeXHH |
||
|---|---|---|
| iac | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| main_test.go | ||
| plan.md | ||
| README.md | ||
| test.sh | ||
Infinite Git
A Git HTTP server that generates a new commit every time someone pulls from the repository.
Try it out
Clone the repo
git clone https://infinite-git-nd2dq3gc7a-uk.a.run.app/ /tmp/infinite-git && cd /tmp/infinite-git
Pull, and just keep pulling:
$ git pull
warning: no common commits
Unpacking objects: 100% (40/40), 4.14 KiB | 847.00 KiB/s, done.
From https://infinite-git-nd2dq3gc7a-uk.a.run.app
df979d4..d483466 main -> origin/main
Updating df979d4..d483466
Fast-forward
hello.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
$ git pull
warning: no common commits
Unpacking objects: 100% (43/43), 4.45 KiB | 912.00 KiB/s, done.
From https://infinite-git-nd2dq3gc7a-uk.a.run.app
d483466..47f0fcb main -> origin/main
Updating d483466..47f0fcb
Fast-forward
hello.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
.....and so on.
How It Works
- When a client initiates a pull/clone, the server intercepts the reference discovery request
- 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
- The new commit is added to the main branch
- The updated refs are sent to the client
- The client receives the new commit as part of the normal Git protocol flow
Why?
I think it's neat!