feat(github): support git clone over smart HTTP#174
Open
MaxLeiter wants to merge 3 commits into
Open
Conversation
- Private-repo access in authorizeGitRequest now relies solely on canAccessRepo (user-id comparison): the login-string fast path would trust any token whose login collides with the owner's, even when the token maps to a different or nonexistent user. - Empty-repo advertisements include symref=HEAD:refs/heads/<default_branch>, matching real GitHub, so clones initialize local HEAD from the server instead of the client's init.defaultBranch. - identityLine throws on unparseable commit dates instead of silently minting epoch (1970) timestamps into sha-stable commits. Found by an automated review sweep; adds tests for all three. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
@MaxLeiter is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the read side of the git smart HTTP protocol to the GitHub emulator, so a
real
gitclient can clone fixture repos:git clone http://x-access-token:$TOKEN@localhost:4001/octocat/hello-world.gitWhy
The emulator covers GitHub's REST surface, but anything exercising an actual
clone/fetch (CI harnesses, agents that do real repo work) currently needs a
separate fake git server next to emulate — splitting fixture state and token
auth across two processes. This closes that gap: the same seeded repos and the
same minted/seeded tokens now serve both REST and the git wire protocol.
How
POST /:owner/:repo/git-upload-pack (clone / full fetch), protocol v0.
no git binary or filesystem dependency; everything resolves through the
in-memory store, and repos materialize with canonical git SHAs so REST git-data
responses and served packfiles agree. Fixture SHAs are deterministic across
restarts.
their generated README.
one this instance seeded or minted (e.g. via
POST /app/installations/:id/access_tokens)— unknown tokens get a 401 ratherthan falling back to a default user, so clone tests can't pass vacuously.
reject .., .git, and null-byte segments.
clones, partial fetches.