git-commit
Import
Section titled “Import”import * as api from "@fungi.computer/agar/git-commit";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | GitCommitStore | The binding operations these writes use. |
| type alias | GitFileChange | One file to write (content) or delete (content: null), repository-relative. |
| type alias | GitIdentity | Name and email recorded as a commit’s author and committer. |
| type alias | CommitFilesRequest | A commit of file changes to one branch. |
| type alias | GitWriteOutcome | What a compare-and-swap write did. |
| type alias | MergeBranchRequest | Merge a branch of source (such as a fork) into a branch of target. |
| type alias | GitMergeOutcome | What a merge did. Merges always write a merge commit when there is new work. |
| type alias | MoveRefRequest | Point a ref at a commit that is the head of source. |
| type alias | MoveRefsRequest | Ordered ref moves to one fetched source commit; each move has its own CAS guard. |
| type alias | GitRefMovesOutcome | Earlier moves remain accepted if a later ref is stale; this is not an atomic push. |
| function | commitFiles() | Commit files using independently resumable, CAS-guarded Git steps. |
| function | moveRef() | Point a ref at the head commit of source, compare-and-swap on the ref. |
| function | moveRefs() | Fetch a source once, then move refs in order with separate guarded pushes. |
| function | mergeBranch() | Merge branches through the same one-exchange step engine as background owners. |
GitCommitStoretype alias
Section titled “GitCommitStore”type GitCommitStore = Pick<GitBinding, "exchange">;The binding operations these writes use.
GitFileChangetype alias
Section titled “GitFileChange”type GitFileChange = Readonly<{ path: string; content: Uint8Array | null; mode?: "100644" | "100755";}>;One file to write (content) or delete (content: null), repository-relative.
GitIdentitytype alias
Section titled “GitIdentity”type GitIdentity = Readonly<{ name: string; email: string;}>;Name and email recorded as a commit’s author and committer.
CommitFilesRequesttype alias
Section titled “CommitFilesRequest”type CommitFilesRequest = Readonly<{ repository: string; branch: string; expectedHead: string | null; startFrom?: string; changes: readonly GitFileChange[]; message: string; author: GitIdentity;}>;A commit of file changes to one branch.
GitWriteOutcometype alias
Section titled “GitWriteOutcome”type GitWriteOutcome = | Readonly<{ kind: "committed"; commit: string; }> | Readonly<{ kind: "unchanged"; commit: string; }> | Readonly<{ kind: "updated"; }> | Readonly<{ kind: "stale"; head: string | null; }>;What a compare-and-swap write did.
MergeBranchRequesttype alias
Section titled “MergeBranchRequest”type MergeBranchRequest = Readonly<{ target: string; source: string; branch: string; sourceBranch: string; expectedSource: string; expectedTarget?: string; behind?: number; message: string; author: GitIdentity;}>;Merge a branch of source (such as a fork) into a branch of target.
GitMergeOutcometype alias
Section titled “GitMergeOutcome”type GitMergeOutcome = | Readonly<{ kind: "merged"; before: string; after: string; }> | Readonly<{ kind: "up-to-date"; head: string; }> | Readonly<{ kind: "conflict"; head: string; paths: readonly string[]; }> | Readonly<{ kind: "stale"; head: string | null; }> | Readonly<{ kind: "source-moved"; head: string; }>;What a merge did. Merges always write a merge commit when there is new work.
MoveRefRequesttype alias
Section titled “MoveRefRequest”type MoveRefRequest = Readonly<{ repository: string; ref: string; expected: string | null; commit: string; source: string;}>;Point a ref at a commit that is the head of source.
MoveRefsRequesttype alias
Section titled “MoveRefsRequest”type MoveRefsRequest = Readonly<{ repository: string; source: string; commit: string; updates: readonly Readonly<{ ref: string; expected: string | null; }>[];}>;Ordered ref moves to one fetched source commit; each move has its own CAS guard.
GitRefMovesOutcometype alias
Section titled “GitRefMovesOutcome”type GitRefMovesOutcome = | Readonly<{ kind: "updated"; }> | Readonly<{ kind: "stale"; ref: string; head: string | null; }>;Earlier moves remain accepted if a later ref is stale; this is not an atomic push.
commitFiles()function
Section titled “commitFiles()”function commitFiles(store, request, beforeWrite?): Promise<GitWriteOutcome>;Commit files using independently resumable, CAS-guarded Git steps.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
store |
GitCommitStore |
request |
CommitFilesRequest |
beforeWrite? |
() => Promise<void> |
Returns
Section titled “Returns”Promise<GitWriteOutcome>
moveRef()function
Section titled “moveRef()”function moveRef(store, request): Promise<GitWriteOutcome>;Point a ref at the head commit of source, compare-and-swap on the ref.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
store |
GitCommitStore |
request |
MoveRefRequest |
Returns
Section titled “Returns”Promise<GitWriteOutcome>
moveRefs()function
Section titled “moveRefs()”function moveRefs(store, request): Promise<GitRefMovesOutcome>;Fetch a source once, then move refs in order with separate guarded pushes.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
store |
GitCommitStore |
request |
MoveRefsRequest |
Returns
Section titled “Returns”Promise<GitRefMovesOutcome>
mergeBranch()function
Section titled “mergeBranch()”function mergeBranch(store, request): Promise<GitMergeOutcome>;Merge branches through the same one-exchange step engine as background owners.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
store |
GitCommitStore |
request |
MergeBranchRequest |
Returns
Section titled “Returns”Promise<GitMergeOutcome>