just-git 1.5.13 → 1.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -4
- package/dist/index.d.ts +12 -1
- package/dist/index.js +260 -260
- package/dist/merge-ort-BYMritNd.d.ts +40 -0
- package/dist/repo/index.d.ts +29 -66
- package/dist/server/index.d.ts +1 -1
- package/dist/{writing-BYrXF-yM.d.ts → writing-DnvEscb-.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* merge-ort — Three-way merge engine modeled after Git's merge-ort.c.
|
|
3
|
+
*
|
|
4
|
+
* Key insight: the entire merge is computed in-core first (producing a
|
|
5
|
+
* result tree with conflict-marker blobs embedded), then a standard
|
|
6
|
+
* two-way checkout applies the result to the worktree.
|
|
7
|
+
*
|
|
8
|
+
* Three phases:
|
|
9
|
+
* 1. collectMergeInfo — flatten three trees, build per-path ConflictInfo
|
|
10
|
+
* 2. detectAndProcessRenames — rename detection, update path map
|
|
11
|
+
* 3. processEntries — resolve conflicts, content merge, build result tree
|
|
12
|
+
*
|
|
13
|
+
* The recursive wrapper (mergeOrtRecursive) handles criss-cross merges
|
|
14
|
+
* by pairwise-merging multiple LCAs into a virtual base tree.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Custom content merge callback. Called during three-way merge before the
|
|
19
|
+
* default line-based diff3 algorithm. Analogous to git's `.gitattributes`
|
|
20
|
+
* `merge=` drivers, but as an async callback rather than a shell command.
|
|
21
|
+
*
|
|
22
|
+
* Return a result to override the default merge, or `null` to fall back
|
|
23
|
+
* to diff3. When `conflict` is `false`, the content is written as a clean
|
|
24
|
+
* stage-0 entry. When `conflict` is `true`, the original base/ours/theirs
|
|
25
|
+
* blobs are preserved as index stages 1/2/3 (so `--ours`/`--theirs`
|
|
26
|
+
* checkout still works) and the returned content becomes the worktree blob.
|
|
27
|
+
*/
|
|
28
|
+
type MergeDriver = (ctx: {
|
|
29
|
+
path: string;
|
|
30
|
+
base: string | null;
|
|
31
|
+
ours: string;
|
|
32
|
+
theirs: string;
|
|
33
|
+
}) => MergeDriverResult | null | Promise<MergeDriverResult | null>;
|
|
34
|
+
/** Result from a {@link MergeDriver} callback. */
|
|
35
|
+
interface MergeDriverResult {
|
|
36
|
+
content: string;
|
|
37
|
+
conflict: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type { MergeDriver as M, MergeDriverResult as a };
|
package/dist/repo/index.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { g as GitRepo, _ as RefEntry, e as Commit, a4 as TreeEntry, i as ObjectId, h as Identity, a5 as TreeDiffEntry, d as GitContext, F as FileSystem } from '../hooks-B50z7ycn.js';
|
|
2
|
-
import {
|
|
3
|
-
export { B as BuildCommitOptions,
|
|
2
|
+
import { C as CommitIdentity } from '../writing-DnvEscb-.js';
|
|
3
|
+
export { B as BuildCommitOptions, a as CommitAuthor, b as CommitOptions, c as CommitResult, d as CreateAnnotatedTagOptions, e as CreateCommitOptions, T as TreeEntryInput, f as TreeUpdate, g as buildCommit, h as commit, i as createAnnotatedTag, j as createCommit, u as updateTree, w as writeBlob, k as writeTree } from '../writing-DnvEscb-.js';
|
|
4
|
+
import { M as MergeDriver } from '../merge-ort-BYMritNd.js';
|
|
5
|
+
export { a as MergeDriverResult } from '../merge-ort-BYMritNd.js';
|
|
6
|
+
|
|
7
|
+
interface MergeConflict {
|
|
8
|
+
path: string;
|
|
9
|
+
reason: "content" | "delete-modify" | "add-add" | "rename-delete" | "rename-rename" | "directory-rename";
|
|
10
|
+
/** For delete-modify / rename-delete: which side deleted the file. */
|
|
11
|
+
deletedBy?: "ours" | "theirs";
|
|
12
|
+
/** For rename conflicts: the old (base) path. */
|
|
13
|
+
oldPath?: string;
|
|
14
|
+
/** For rename/rename: the path ours renamed to. */
|
|
15
|
+
oursPath?: string;
|
|
16
|
+
/** For rename/rename: the path theirs renamed to. */
|
|
17
|
+
theirsPath?: string;
|
|
18
|
+
/**
|
|
19
|
+
* For content conflicts arising from renames: the path where ours' version
|
|
20
|
+
* was before the merge. If different from `path`, indicates ours had the
|
|
21
|
+
* file at a different location.
|
|
22
|
+
*/
|
|
23
|
+
oursOrigPath?: string;
|
|
24
|
+
/**
|
|
25
|
+
* For content conflicts arising from renames: the path where theirs'
|
|
26
|
+
* version was before the merge.
|
|
27
|
+
*/
|
|
28
|
+
theirsOrigPath?: string;
|
|
29
|
+
}
|
|
4
30
|
|
|
5
31
|
/** Extract the short branch name from a full ref path like "refs/heads/main" → "main". */
|
|
6
32
|
declare function branchNameFromRef(ref: string): string;
|
|
@@ -271,69 +297,6 @@ declare function walkCommitHistory(repo: GitRepo, startHash: string | string[],
|
|
|
271
297
|
limit?: number;
|
|
272
298
|
}): AsyncGenerator<CommitInfo>;
|
|
273
299
|
|
|
274
|
-
interface MergeConflict {
|
|
275
|
-
path: string;
|
|
276
|
-
reason: "content" | "delete-modify" | "add-add" | "rename-delete" | "rename-rename" | "directory-rename";
|
|
277
|
-
/** For delete-modify / rename-delete: which side deleted the file. */
|
|
278
|
-
deletedBy?: "ours" | "theirs";
|
|
279
|
-
/** For rename conflicts: the old (base) path. */
|
|
280
|
-
oldPath?: string;
|
|
281
|
-
/** For rename/rename: the path ours renamed to. */
|
|
282
|
-
oursPath?: string;
|
|
283
|
-
/** For rename/rename: the path theirs renamed to. */
|
|
284
|
-
theirsPath?: string;
|
|
285
|
-
/**
|
|
286
|
-
* For content conflicts arising from renames: the path where ours' version
|
|
287
|
-
* was before the merge. If different from `path`, indicates ours had the
|
|
288
|
-
* file at a different location.
|
|
289
|
-
*/
|
|
290
|
-
oursOrigPath?: string;
|
|
291
|
-
/**
|
|
292
|
-
* For content conflicts arising from renames: the path where theirs'
|
|
293
|
-
* version was before the merge.
|
|
294
|
-
*/
|
|
295
|
-
theirsOrigPath?: string;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* merge-ort — Three-way merge engine modeled after Git's merge-ort.c.
|
|
300
|
-
*
|
|
301
|
-
* Key insight: the entire merge is computed in-core first (producing a
|
|
302
|
-
* result tree with conflict-marker blobs embedded), then a standard
|
|
303
|
-
* two-way checkout applies the result to the worktree.
|
|
304
|
-
*
|
|
305
|
-
* Three phases:
|
|
306
|
-
* 1. collectMergeInfo — flatten three trees, build per-path ConflictInfo
|
|
307
|
-
* 2. detectAndProcessRenames — rename detection, update path map
|
|
308
|
-
* 3. processEntries — resolve conflicts, content merge, build result tree
|
|
309
|
-
*
|
|
310
|
-
* The recursive wrapper (mergeOrtRecursive) handles criss-cross merges
|
|
311
|
-
* by pairwise-merging multiple LCAs into a virtual base tree.
|
|
312
|
-
*/
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Custom content merge callback. Called during three-way merge before the
|
|
316
|
-
* default line-based diff3 algorithm. Analogous to git's `.gitattributes`
|
|
317
|
-
* `merge=` drivers, but as an async callback rather than a shell command.
|
|
318
|
-
*
|
|
319
|
-
* Return a result to override the default merge, or `null` to fall back
|
|
320
|
-
* to diff3. When `conflict` is `false`, the content is written as a clean
|
|
321
|
-
* stage-0 entry. When `conflict` is `true`, the original base/ours/theirs
|
|
322
|
-
* blobs are preserved as index stages 1/2/3 (so `--ours`/`--theirs`
|
|
323
|
-
* checkout still works) and the returned content becomes the worktree blob.
|
|
324
|
-
*/
|
|
325
|
-
type MergeDriver = (ctx: {
|
|
326
|
-
path: string;
|
|
327
|
-
base: string | null;
|
|
328
|
-
ours: string;
|
|
329
|
-
theirs: string;
|
|
330
|
-
}) => MergeDriverResult | null | Promise<MergeDriverResult | null>;
|
|
331
|
-
/** Result from a {@link MergeDriver} callback. */
|
|
332
|
-
interface MergeDriverResult {
|
|
333
|
-
content: string;
|
|
334
|
-
conflict: boolean;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
300
|
/** Result of a tree-level merge via {@link mergeTrees} or {@link mergeTreesFromTreeHashes}. */
|
|
338
301
|
interface MergeTreesResult {
|
|
339
302
|
/** Hash of the result tree (may contain conflict-marker blobs). */
|
|
@@ -758,4 +721,4 @@ declare function readonlyRepo(repo: GitRepo): GitRepo;
|
|
|
758
721
|
*/
|
|
759
722
|
declare function overlayRepo(repo: GitRepo): GitRepo;
|
|
760
723
|
|
|
761
|
-
export { type BisectOptions, type BisectSearchResult, type BisectStepInfo, type BlameEntry, type CherryPickOptions, type CherryPickResult, type CleanPickCommitted, type CleanPickNoCommit, Commit, CommitIdentity, type CommitInfo, type CreateWorktreeOptions, type DiffHunk, type DiffOptions, type ExtractTreeResult, type FileDiff, type FlatTreeEntry, GitRepo, type GrepFileMatch, type GrepMatch, type GrepOptions, type HeadInfo, Identity, type MaterializeTarget, type MergeConflict,
|
|
724
|
+
export { type BisectOptions, type BisectSearchResult, type BisectStepInfo, type BlameEntry, type CherryPickOptions, type CherryPickResult, type CleanPickCommitted, type CleanPickNoCommit, Commit, CommitIdentity, type CommitInfo, type CreateWorktreeOptions, type DiffHunk, type DiffOptions, type ExtractTreeResult, type FileDiff, type FlatTreeEntry, GitRepo, type GrepFileMatch, type GrepMatch, type GrepOptions, type HeadInfo, Identity, type MaterializeTarget, type MergeConflict, MergeDriver, type MergeTreesResult, type NoCommitPickResult, type NoCommitRevertResult, type PickConflict, RefEntry, type RevertOptions, type RevertResult, type TreeAccessor, TreeDiffEntry, TreeEntry, type WorktreeResult, bisect, blame, branchNameFromRef, cherryPick, countAheadBehind, createSandboxWorktree, createTreeAccessor, createWorktree, diffCommits, diffTrees, extractTree, findMergeBases, flattenTree, formatDiff, getChangedFiles, getNewCommits, grep, isAncestor, listBranches, listTags, mergeTrees, mergeTreesFromTreeHashes, overlayRepo, readBlob, readBlobText, readCommit, readFileAtCommit, readHead, readTree, readonlyRepo, resolveRef, revParse, revert, tagNameFromRef, walkCommitHistory };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as ObjectId, X as RawObject, Y as Ref, g as GitRepo, a0 as Rejection, N as NetworkPolicy } from '../hooks-B50z7ycn.js';
|
|
2
|
-
import {
|
|
2
|
+
import { b as CommitOptions, c as CommitResult } from '../writing-DnvEscb-.js';
|
|
3
3
|
|
|
4
4
|
/** Shallow boundary delta: what to add/remove from `.git/shallow`. */
|
|
5
5
|
interface ShallowUpdate {
|
|
@@ -201,4 +201,4 @@ interface TreeUpdate {
|
|
|
201
201
|
*/
|
|
202
202
|
declare function updateTree(repo: GitRepo, treeHash: string, updates: TreeUpdate[]): Promise<string>;
|
|
203
203
|
|
|
204
|
-
export { type BuildCommitOptions as B, type
|
|
204
|
+
export { type BuildCommitOptions as B, type CommitIdentity as C, type TreeEntryInput as T, type CommitAuthor as a, type CommitOptions as b, type CommitResult as c, type CreateAnnotatedTagOptions as d, type CreateCommitOptions as e, type TreeUpdate as f, buildCommit as g, commit as h, createAnnotatedTag as i, createCommit as j, writeTree as k, updateTree as u, writeBlob as w };
|