Expand description
HTTP client for the Git LFS batch and locking APIs.
Git LFS speaks to a server over HTTPS using two endpoints.
The batch endpoint (POST /objects/batch) takes a list of
OIDs and sizes and returns one transfer URL per object
(plus any auth headers and an expiry window); the locking
endpoint suite (/locks, /locks/verify,
/locks/{id}/unlock, …) lets clients claim files to
coordinate edits across users. See the batch spec
and locking spec for the wire-protocol contract.
Client is the entry point. Construct one per endpoint
URL with an initial Auth (None, Basic, or Bearer),
optionally attach a credential helper via
Client::with_credential_helper and an SshResolver
via Client::with_ssh_resolver, then invoke the
per-operation methods. Client is cheap to clone and shares
an underlying connection pool.
Request and response types are split by operation. Batch
uses BatchRequest and BatchResponse, with
ObjectResult carrying either Actions or an
ObjectError per object. Lock operations use
CreateLockRequest, ListLocksFilter,
VerifyLocksRequest, and DeleteLockRequest, with
Lock, Owner, and Ref as the shared model types.
On a 401 the client queries the attached credential helper,
retries once, and reports approve or reject based on the
outcome. Successful fills are cached for the lifetime of the
Client. SSH-mediated endpoints (via SshResolver) can
swap in a replacement HTTPS URL and auth headers per request.
Failures surface as ApiError, with predicates
(is_unauthorized,
is_retryable, …) for dispatch
without matching on the variant. Server-supplied
Retry-After (on 429 or 5xx responses) reaches callers via
ApiError::retry_after; parse_retry_after is exported
for reuse on other response paths.
Byte transfer against action URLs lives in
git-lfs-transfer; credential resolution
lives in git-lfs-creds; server URL
discovery from a git remote lives in
git-lfs-git.
Structs§
- Action
- One concrete HTTP request the transfer adapter should make.
- Actions
- The set of next-step actions the server returned for one object.
- Batch
Request - A POST body for
/objects/batch. - Batch
Response - Response body from
/objects/batch. - Client
- HTTP client for the git-lfs API endpoints.
- Create
Lock Request - POST
/locksbody. - Delete
Lock Request - POST
/locks/{id}/unlockbody. Requests deletion of a single lock. - List
Locks Filter - Filter for
GET /locks. All fields are optional; absent ones are not sent on the wire. - Lock
- A lock record returned by the locking API.
- Lock
List - Response body from
GET /locks. A page of locks plus an optional continuation cursor. - Object
Error - Per-object error inside a batch response.
- Object
Result - Per-object result inside a batch response.
- Object
Spec - One object the client wants to transfer.
- Owner
- User identity attached to a lock by the server.
- Ref
- A server refspec, used by both batch and locking requests for auth schemes that take the ref into account (added in LFS v2.4).
- Server
Error - The standard error body returned by the LFS server for non-2xx responses.
- SshAuth
- Resolved auth from a
git-lfs-authenticatecall. - Verify
Locks Request - POST
/locks/verifybody. Asks the server to partition known locks into ours and theirs. - Verify
Locks Response - Response body from
POST /locks/verify. Locks split by owner.
Enums§
- ApiError
- Errors returned by the API client.
- Auth
- Authentication to attach to API requests.
- Create
Lock Error - Errors specific to
Client::create_lock. - Operation
- Operation requested from the batch endpoint.
- SshOperation
git-lfs-authenticate <path> <op>operation argument. Wire form is lowercaseuploadordownload.
Traits§
- SshResolver
- Hook called once per LFS API request to resolve SSH-mediated auth.
Functions§
- parse_
retry_ after - Parse a
Retry-Afterheader value.
Type Aliases§
- Shared
SshResolver - Type alias for the boxed-resolver field on
Client.