/** * Textual merge oracle for `map_in_flight_conflicts` (change: add-merge-tree-conflict-oracle). * * Answers one question per pair of in-flight commits: will git auto-merge the text, or report a * conflict? It runs `git merge-tree --write-tree` between the two tips over their merge base. * * Read-only and safe on an untrusted repository, by construction: * - **No writes to the analyzed repository.** `merge-tree --write-tree` writes the merged blobs and * trees into the object store. The merge runs in a new, empty bare repository in the OS temp * directory that reads the real objects through `objects/info/alternates`, so every new object * lands in the scratch repository, which is removed afterwards. * - **No repository-chosen commands.** A `merge=` attribute makes git RUN the command in * `merge..driver`, and the driver name comes from `.gitattributes` or * `$GIT_DIR/info/attributes`, so it cannot be turned off with `-c` or `--attr-source`. The scratch * repository has no config, no info directory, and an unborn HEAD, so no attribute or driver of * the analyzed repository is ever read. The trade-off is disclosed: a repository that relies on a * custom merge driver or `merge=union` may merge differently than this simulation. * - **No silent divergence from a real merge.** Settings the scratch repository cannot see are * checked in the real repository with value-only reads (`git config`, `git check-attr`, which * run no driver): rename settings are forwarded as `-c` values, while a non-default `merge` * attribute on a changed path, `merge.default`, `merge.renormalize`, branch merge options, * replace refs or grafts, or a submodule conflict makes the pair `not-assessed`. * - **No guessed base.** The scratch repository has no shallow-clone boundary, so it could compute a * wrong merge base. The base is resolved in the real repository and passed with `--merge-base`; a * missing base (shallow clone, unrelated histories) or several bases (criss-cross history) is * `not-assessed`, never `clean-automerge`. */ export type TextualMergeVerdict = 'textual-conflict' | 'clean-automerge' | 'not-assessed'; export interface TextualMerge { verdict: TextualMergeVerdict; /** Files git reports as conflicted (sorted, capped); set for `textual-conflict`. */ conflictedFiles?: string[]; /** Total conflicted files before the cap; set for `textual-conflict`. */ conflictedFileCount?: number; /** Why the merge could not be simulated; set for `not-assessed`. */ detail?: string; } export interface SimulateMergeOptions { /** Epoch milliseconds after which no git process is started and running ones are killed. */ deadline?: number; /** Parent directory for the scratch repository (default: the OS temp directory). */ scratchParent?: string; } /** * Environment for git reads in an analyzed repository. In a partial clone git lazily fetches a * missing object from the promisor remote, and for a local-path remote that runs the command in * the repository's own `remote..uploadpack`. `GIT_NO_LAZY_FETCH` (git 2.45+) turns the fetch * off, so a missing object is a read failure (and the verdict `not-assessed`) instead. */ export declare function noLazyFetchEnv(): NodeJS.ProcessEnv; /** True when `git --version` output names version `major.minor` or later. */ export declare function gitVersionAtLeast(versionOutput: string, major: number, minor: number): boolean; /** * Simulate merging commit `tipA` with commit `tipB` in `repoPath`. Both tips must be object ids. * Never throws: every failure is a `not-assessed` verdict with a detail. */ export declare function simulateMerge(repoPath: string, tipA: string, tipB: string, options?: SimulateMergeOptions): Promise; //# sourceMappingURL=merge-oracle.d.ts.map