just-git 1.5.7 → 1.5.9

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.
@@ -1,5 +1,5 @@
1
1
  import { g as GitRepo, Z as RefEntry, e as Commit, a3 as TreeEntry, i as ObjectId, h as Identity, a4 as TreeDiffEntry, d as GitContext, F as FileSystem } from '../hooks-CimfP56a.js';
2
- export { B as BuildCommitOptions, b as CommitAuthor, c as CommitIdentity, C as CommitOptions, a 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-CF-eYohc.js';
2
+ export { B as BuildCommitOptions, C as CommitAuthor, a as CommitIdentity, 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-IwfRRrts.js';
3
3
 
4
4
  /** Extract the short branch name from a full ref path like "refs/heads/main" → "main". */
5
5
  declare function branchNameFromRef(ref: string): string;
@@ -281,6 +281,45 @@ interface MergeConflict {
281
281
  theirsOrigPath?: string;
282
282
  }
283
283
 
284
+ /**
285
+ * merge-ort — Three-way merge engine modeled after Git's merge-ort.c.
286
+ *
287
+ * Key insight: the entire merge is computed in-core first (producing a
288
+ * result tree with conflict-marker blobs embedded), then a standard
289
+ * two-way checkout applies the result to the worktree.
290
+ *
291
+ * Three phases:
292
+ * 1. collectMergeInfo — flatten three trees, build per-path ConflictInfo
293
+ * 2. detectAndProcessRenames — rename detection, update path map
294
+ * 3. processEntries — resolve conflicts, content merge, build result tree
295
+ *
296
+ * The recursive wrapper (mergeOrtRecursive) handles criss-cross merges
297
+ * by pairwise-merging multiple LCAs into a virtual base tree.
298
+ */
299
+
300
+ /**
301
+ * Custom content merge callback. Called during three-way merge before the
302
+ * default line-based diff3 algorithm. Analogous to git's `.gitattributes`
303
+ * `merge=` drivers, but as an async callback rather than a shell command.
304
+ *
305
+ * Return a result to override the default merge, or `null` to fall back
306
+ * to diff3. When `conflict` is `false`, the content is written as a clean
307
+ * stage-0 entry. When `conflict` is `true`, the original base/ours/theirs
308
+ * blobs are preserved as index stages 1/2/3 (so `--ours`/`--theirs`
309
+ * checkout still works) and the returned content becomes the worktree blob.
310
+ */
311
+ type MergeDriver = (ctx: {
312
+ path: string;
313
+ base: string | null;
314
+ ours: string;
315
+ theirs: string;
316
+ }) => MergeDriverResult | null | Promise<MergeDriverResult | null>;
317
+ /** Result from a {@link MergeDriver} callback. */
318
+ interface MergeDriverResult {
319
+ content: string;
320
+ conflict: boolean;
321
+ }
322
+
284
323
  /** Result of a tree-level merge via {@link mergeTrees} or {@link mergeTreesFromTreeHashes}. */
285
324
  interface MergeTreesResult {
286
325
  /** Hash of the result tree (may contain conflict-marker blobs). */
@@ -303,18 +342,20 @@ interface MergeTreesResult {
303
342
  * Use `mergeTreesFromTreeHashes` if you already have tree hashes and a
304
343
  * known base tree.
305
344
  */
306
- declare function mergeTrees(repo: GitRepo, oursCommit: string, theirsCommit: string, labels?: {
345
+ declare function mergeTrees(repo: GitRepo, oursCommit: string, theirsCommit: string, options?: {
307
346
  ours?: string;
308
347
  theirs?: string;
348
+ mergeDriver?: MergeDriver;
309
349
  }): Promise<MergeTreesResult>;
310
350
  /**
311
351
  * Three-way tree merge from raw tree hashes. Useful when you already
312
352
  * have the base/ours/theirs trees and don't want automatic merge-base
313
353
  * computation.
314
354
  */
315
- declare function mergeTreesFromTreeHashes(repo: GitRepo, baseTree: string | null, oursTree: string, theirsTree: string, labels?: {
355
+ declare function mergeTreesFromTreeHashes(repo: GitRepo, baseTree: string | null, oursTree: string, theirsTree: string, options?: {
316
356
  ours?: string;
317
357
  theirs?: string;
358
+ mergeDriver?: MergeDriver;
318
359
  }): Promise<MergeTreesResult>;
319
360
 
320
361
  /** Result of {@link extractTree}. */
@@ -574,4 +615,4 @@ declare function readonlyRepo(repo: GitRepo): GitRepo;
574
615
  */
575
616
  declare function overlayRepo(repo: GitRepo): GitRepo;
576
617
 
577
- export { type BisectOptions, type BisectSearchResult, type BisectStepInfo, type BlameEntry, Commit, 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, type MergeTreesResult, RefEntry, type TreeAccessor, TreeDiffEntry, TreeEntry, type WorktreeResult, bisect, blame, branchNameFromRef, 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, tagNameFromRef, walkCommitHistory };
618
+ export { type BisectOptions, type BisectSearchResult, type BisectStepInfo, type BlameEntry, Commit, 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, type MergeDriver, type MergeDriverResult, type MergeTreesResult, RefEntry, type TreeAccessor, TreeDiffEntry, TreeEntry, type WorktreeResult, bisect, blame, branchNameFromRef, 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, tagNameFromRef, walkCommitHistory };