Reference
import { /* ... */ } from 'git-edge';threeWayMergethreeWayMerge(repo: Repo, sourceRef: string, targetRef: string, opts?: MergeOpts): Promise<MergeResult>| Parameter | Type | Description |
|---|---|---|
opts.message? | string | Default `Merge ${sourceRef} into ${targetRef}`. |
opts.authorName? | string | Default "Git Edge". |
opts.authorEmail? | string | Default "git-edge@local". |
Returns: Promise<{ commitOid: string }>
Object-level three-way merge — no worktree. Throws GitMergeConflictError
on unresolved content conflicts. See
Three-way merge for the full decision
tree.
analyzeMergeanalyzeMerge(repo: Repo, sourceRef: string, targetRef: string): Promise<MergeAnalysis>Returns: Promise<{ canMerge; fastForward; diverged }>
Cheap pre-merge ancestry check — doesn’t walk trees or detect content
conflicts. See
Analyzing a merge for the
canMerge: false error-propagation contract.
Parsed-object cache
Section titled “Parsed-object cache”createParsedObjectCachecreateParsedObjectCache(options?: ParsedObjectCacheOptions): ParsedObjectStore| Parameter | Type | Description |
|---|---|---|
options.maxSize? | number | Byte budget via JSON.stringify length. Default 256 MiB. |
options.ttl? | number | Entry TTL in ms. Default 1 hour. |
Returns: ParsedObjectStore
A generic in-memory LRU for any JS value, keyed however you like. See the parsed-object cache guide.
ParsedObjectStore — the returned interface:
interface ParsedObjectStore { get<T extends object>(key: string): T | null; set<T extends object>(key: string, value: T): void; delete(key: string): void; invalidatePrefix(prefix: string): void;}Repo cache & init
Section titled “Repo cache & init”getRepoCachegetRepoCache(ownerKey: string, repoName: string): objectReturns: object
The long-lived isomorphic-git packfile cache for a repo, created on
first access. See
Repo cache & init.
invalidateRepoCacheinvalidateRepoCache(ownerKey: string, repoName: string): voidDrops a repo’s cached packfile state — call after any out-of-process storage rewrite.
initBareRepoinitBareRepo(repo: Repo, defaultBranch?: string): Promise<void>| Parameter | Type | Description |
|---|---|---|
defaultBranch? | string | Default "main". |
Thin wrapper over git.init({ ...repo, bare: true }).
estimateRepoSizeestimateRepoSize(repo: Repo, stat: (path: string) => Promise<{ size: number }>, list: (path: string) => Promise<string[]>): Promise<number>Returns: Promise<number>
Sums .pack/loose-object file sizes under objects/. Can be expensive
against remote storage — see the caution in
Repo cache & init.
Errors
Section titled “Errors”class GitMergeConflictError extends GitEdgeErrorThrown only by threeWayMerge. Carries conflictingPaths: string[].
| Export | Shape |
|---|---|
Repo |
{ fs: FsClient; gitdir: string; cache?: object } |
MergeOpts |
{ message?, authorName?, authorEmail? } |
MergeResult |
{ commitOid: string } |
MergeAnalysis |
{ canMerge: boolean; fastForward: boolean; diverged: boolean } |
ParsedObjectCacheOptions |
{ maxSize?: number; ttl?: number } |