@scolladon/tsgit 2.0.1 → 3.1.0
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 +14 -2
- package/dist/cjs/adapters/browser/index.cjs +1 -2
- package/dist/cjs/adapters/memory/index.cjs +1 -2
- package/dist/cjs/adapters/node/index.cjs +1 -2
- package/dist/cjs/chunks/adapter-detect-DW9fsw9d.cjs +1 -0
- package/dist/cjs/chunks/browser-http-transport-DGwW5YL7.cjs +1 -0
- package/dist/cjs/chunks/context-BcoAzPuU.cjs +0 -1
- package/dist/cjs/chunks/error-CfLWDui_.cjs +1 -0
- package/dist/cjs/chunks/index-Cy44GVR6.cjs +1 -0
- package/dist/cjs/chunks/inflate-CmCtM4-w.cjs +1 -0
- package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs +0 -1
- package/dist/cjs/chunks/memory-http-transport-CGriODcQ.cjs +1 -0
- package/dist/cjs/chunks/node-ssh-transport-PFu3ijfp.cjs +1 -0
- package/dist/cjs/chunks/{progress-CxU62NC1.cjs → progress-D8Dqbftk.cjs} +1 -2
- package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +0 -1
- package/dist/cjs/chunks/repository-Ci-BBxk0.cjs +1 -0
- package/dist/cjs/chunks/write-sparse-checkout-C1dsHCAD.cjs +1 -0
- package/dist/cjs/commands/index.cjs +1 -2
- package/dist/cjs/index.browser.cjs +1 -2
- package/dist/cjs/index.cjs +1 -2
- package/dist/cjs/index.default.cjs +1 -2
- package/dist/cjs/index.node.cjs +1 -2
- package/dist/cjs/operators/index.cjs +0 -1
- package/dist/cjs/primitives/index.cjs +1 -2
- package/dist/cjs/transport/index.cjs +0 -1
- package/dist/esm/adapters/browser/index.js +1 -2
- package/dist/esm/adapters/memory/index.js +1 -2
- package/dist/esm/adapters/node/index.js +1 -2
- package/dist/esm/chunks/adapter-detect-BkCMnjrI.js +1 -0
- package/dist/esm/chunks/browser-http-transport-CSxAte5h.js +1 -0
- package/dist/esm/chunks/context-CumKOV7K.js +0 -1
- package/dist/esm/chunks/error-BotOd-nD.js +1 -0
- package/dist/esm/chunks/index-DsvINN8n.js +1 -0
- package/dist/esm/chunks/inflate-BCIXqeeE.js +1 -0
- package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js +0 -1
- package/dist/esm/chunks/memory-http-transport-caqmMGR1.js +1 -0
- package/dist/esm/chunks/node-ssh-transport-BgSv2IhT.js +1 -0
- package/dist/esm/chunks/{progress-BZobfl7p.js → progress-B_AJnOHx.js} +1 -2
- package/dist/esm/chunks/readable-stream-CGuf8k1J.js +0 -1
- package/dist/esm/chunks/repository-DyxknzvE.js +1 -0
- package/dist/esm/chunks/write-sparse-checkout-BwHbNKNS.js +1 -0
- package/dist/esm/commands/index.js +1 -2
- package/dist/esm/index.browser.js +1 -2
- package/dist/esm/index.default.js +1 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.node.js +1 -2
- package/dist/esm/operators/index.js +0 -1
- package/dist/esm/primitives/index.js +1 -2
- package/dist/esm/transport/index.js +0 -1
- package/dist/types/adapters/browser/index.d.cts +5 -3
- package/dist/types/adapters/browser/index.d.ts +5 -3
- package/dist/types/adapters/memory/index.d.cts +31 -4
- package/dist/types/adapters/memory/index.d.ts +31 -4
- package/dist/types/adapters/node/index.d.cts +146 -40
- package/dist/types/adapters/node/index.d.ts +146 -40
- package/dist/types/chunks/{context-YDw6qicq.d.cts → context-CF1YF2S8.d.cts} +165 -6
- package/dist/types/chunks/{context-CCL0_F8R.d.ts → context-sIhhtk2u.d.ts} +165 -6
- package/dist/types/chunks/{http-transport--_NdQOiw.d.cts → http-transport-DirKfK2S.d.cts} +1 -1
- package/dist/types/chunks/{http-transport--_NdQOiw.d.ts → http-transport-DirKfK2S.d.ts} +1 -1
- package/dist/types/chunks/index-B5Dps3fg.d.ts +2468 -0
- package/dist/types/chunks/index-B_A8VLaf.d.ts +1221 -0
- package/dist/types/chunks/index-Dfh8cvEs.d.cts +2468 -0
- package/dist/types/chunks/index-Dqxddhav.d.cts +1221 -0
- package/dist/types/chunks/progress-BjAKfkam.d.ts +1217 -0
- package/dist/types/chunks/progress-Ldnfb8st.d.cts +1217 -0
- package/dist/types/chunks/reflog-entry-Cqh3QrPH.d.ts +697 -0
- package/dist/types/chunks/reflog-entry-Dy-O27Dd.d.cts +697 -0
- package/dist/types/chunks/{repository-FoS_Laoy.d.ts → repository-D8QBTkEz.d.ts} +58 -20
- package/dist/types/chunks/{repository-BeifCqp0.d.cts → repository-D9YrVhcH.d.cts} +58 -20
- package/dist/types/commands/index.d.cts +4 -1259
- package/dist/types/commands/index.d.ts +4 -1259
- package/dist/types/index.browser.d.cts +7 -8
- package/dist/types/index.browser.d.ts +7 -8
- package/dist/types/index.d.cts +61 -124
- package/dist/types/index.d.ts +61 -124
- package/dist/types/index.default.d.cts +7 -8
- package/dist/types/index.default.d.ts +7 -8
- package/dist/types/index.node.d.cts +7 -8
- package/dist/types/index.node.d.ts +7 -8
- package/dist/types/primitives/index.d.cts +4 -692
- package/dist/types/primitives/index.d.ts +4 -692
- package/dist/types/transport/index.d.cts +1 -1
- package/dist/types/transport/index.d.ts +1 -1
- package/package.json +94 -28
- package/dist/cjs/adapters/browser/index.cjs.map +0 -1
- package/dist/cjs/adapters/memory/index.cjs.map +0 -1
- package/dist/cjs/adapters/node/index.cjs.map +0 -1
- package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs +0 -2
- package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs.map +0 -1
- package/dist/cjs/chunks/browser-http-transport-CiMRqtDS.cjs +0 -2
- package/dist/cjs/chunks/browser-http-transport-CiMRqtDS.cjs.map +0 -1
- package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +0 -1
- package/dist/cjs/chunks/error-CfjFO3x_.cjs +0 -2
- package/dist/cjs/chunks/error-CfjFO3x_.cjs.map +0 -1
- package/dist/cjs/chunks/index-BWCq_5BJ.cjs +0 -2
- package/dist/cjs/chunks/index-BWCq_5BJ.cjs.map +0 -1
- package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs.map +0 -1
- package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs +0 -2
- package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs.map +0 -1
- package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs +0 -2
- package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs.map +0 -1
- package/dist/cjs/chunks/progress-CxU62NC1.cjs.map +0 -1
- package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +0 -1
- package/dist/cjs/chunks/repository-BEg2zNtx.cjs +0 -2
- package/dist/cjs/chunks/repository-BEg2zNtx.cjs.map +0 -1
- package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs +0 -2
- package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs.map +0 -1
- package/dist/cjs/commands/index.cjs.map +0 -1
- package/dist/cjs/index.browser.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.default.cjs.map +0 -1
- package/dist/cjs/index.node.cjs.map +0 -1
- package/dist/cjs/operators/index.cjs.map +0 -1
- package/dist/cjs/primitives/index.cjs.map +0 -1
- package/dist/cjs/transport/index.cjs.map +0 -1
- package/dist/esm/adapters/browser/index.js.map +0 -1
- package/dist/esm/adapters/memory/index.js.map +0 -1
- package/dist/esm/adapters/node/index.js.map +0 -1
- package/dist/esm/chunks/adapter-detect-DkZhhUhd.js +0 -2
- package/dist/esm/chunks/adapter-detect-DkZhhUhd.js.map +0 -1
- package/dist/esm/chunks/browser-http-transport-4rJkHcQu.js +0 -2
- package/dist/esm/chunks/browser-http-transport-4rJkHcQu.js.map +0 -1
- package/dist/esm/chunks/context-CumKOV7K.js.map +0 -1
- package/dist/esm/chunks/error-Dc-SRSJK.js +0 -2
- package/dist/esm/chunks/error-Dc-SRSJK.js.map +0 -1
- package/dist/esm/chunks/index-jH0UMhh-.js +0 -2
- package/dist/esm/chunks/index-jH0UMhh-.js.map +0 -1
- package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js.map +0 -1
- package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js +0 -2
- package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js.map +0 -1
- package/dist/esm/chunks/node-http-transport-DPa2lK3T.js +0 -2
- package/dist/esm/chunks/node-http-transport-DPa2lK3T.js.map +0 -1
- package/dist/esm/chunks/progress-BZobfl7p.js.map +0 -1
- package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +0 -1
- package/dist/esm/chunks/repository-DF6ePd1x.js +0 -2
- package/dist/esm/chunks/repository-DF6ePd1x.js.map +0 -1
- package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js +0 -2
- package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js.map +0 -1
- package/dist/esm/commands/index.js.map +0 -1
- package/dist/esm/index.browser.js.map +0 -1
- package/dist/esm/index.default.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.node.js.map +0 -1
- package/dist/esm/operators/index.js.map +0 -1
- package/dist/esm/primitives/index.js.map +0 -1
- package/dist/esm/transport/index.js.map +0 -1
- package/dist/types/chunks/index-entry-DtEbVpOG.d.cts +0 -47
- package/dist/types/chunks/index-entry-UD4dvtKh.d.ts +0 -47
- package/dist/types/chunks/progress-7KKiXXfX.d.ts +0 -405
- package/dist/types/chunks/progress-By8yFaUE.d.cts +0 -405
- package/dist/types/chunks/reflog-entry-BbNnXCTC.d.cts +0 -368
- package/dist/types/chunks/reflog-entry-CSzjnZd4.d.ts +0 -368
- package/dist/types/chunks/write-tree-C3oNxOlX.d.cts +0 -196
- package/dist/types/chunks/write-tree-DRI-LzSr.d.ts +0 -196
|
@@ -1,692 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export { H as HashBlobOptions, z as HookInput, I as IsIgnoredMatch, A as IsIgnoredMatchSource, B as IsIgnoredQuery, S as SetEntryFlagsOptions, C as StageEntryOptions, D as StageEntrySource, U as UnstageEntryOptions, c as catFileBatch, a as createCommit, d as diffTrees, g as getRepoRoot, h as hashBlob, i as isIgnored, m as mergeBase, r as readBlob, b as readIndex, e as readObject, f as readTree, j as recordRefUpdate, k as resolveRef, l as runHook, s as setEntryFlags, E as sparseCheckoutPath, n as stageEntry, u as unstageEntry, o as updateRef, w as walkCommits, p as walkSubmodules, q as walkTree, t as walkWorkingTree, v as writeObject, x as writeSymbolicRef, y as writeTree } from '../chunks/write-tree-C3oNxOlX.cjs';
|
|
6
|
-
import { H as HttpTransport } from '../chunks/http-transport--_NdQOiw.cjs';
|
|
7
|
-
|
|
8
|
-
interface FlatTreeEntry {
|
|
9
|
-
readonly id: ObjectId;
|
|
10
|
-
readonly mode: FileMode;
|
|
11
|
-
}
|
|
12
|
-
interface FlatTree {
|
|
13
|
-
readonly entries: ReadonlyMap<FilePath, FlatTreeEntry>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** `true` ⇒ the path is in the sparse set (materialise it). */
|
|
17
|
-
type SparseMatcher = (path: FilePath) => boolean;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Pure helper that diffs a current GitIndex against a target tree's flat
|
|
21
|
-
* entry list and emits an ordered ChangesetEntry list. No FS, no ctx; the
|
|
22
|
-
* impure write side lives in `apply-changeset.ts`.
|
|
23
|
-
*
|
|
24
|
-
* Stage-0 entries only — unmerged stages are invisible to checkout (Phase
|
|
25
|
-
* 13.1 design step 5).
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
interface ChangesetEntry {
|
|
29
|
-
readonly kind: 'add' | 'update' | 'delete' | 'noop';
|
|
30
|
-
readonly path: FilePath;
|
|
31
|
-
readonly mode: FileMode;
|
|
32
|
-
readonly id: ObjectId | undefined;
|
|
33
|
-
readonly previousId: ObjectId | undefined;
|
|
34
|
-
readonly previousMode: FileMode | undefined;
|
|
35
|
-
}
|
|
36
|
-
interface ChangesetStats {
|
|
37
|
-
readonly add: number;
|
|
38
|
-
readonly update: number;
|
|
39
|
-
readonly delete: number;
|
|
40
|
-
readonly noop: number;
|
|
41
|
-
}
|
|
42
|
-
interface Changeset {
|
|
43
|
-
readonly entries: ReadonlyArray<ChangesetEntry>;
|
|
44
|
-
readonly stats: ChangesetStats;
|
|
45
|
-
}
|
|
46
|
-
interface TargetEntry {
|
|
47
|
-
readonly path: FilePath;
|
|
48
|
-
readonly id: ObjectId;
|
|
49
|
-
readonly mode: FileMode;
|
|
50
|
-
}
|
|
51
|
-
declare const computeChangeset: (currentIndex: GitIndex, targetTree: ReadonlyArray<TargetEntry>) => Changeset;
|
|
52
|
-
|
|
53
|
-
interface ApplyChangesetOpts {
|
|
54
|
-
readonly changeset: Changeset;
|
|
55
|
-
readonly force: boolean;
|
|
56
|
-
readonly workdir: string;
|
|
57
|
-
}
|
|
58
|
-
interface ApplyChangesetResult {
|
|
59
|
-
readonly writtenEntries: ReadonlyArray<IndexEntry>;
|
|
60
|
-
readonly written: number;
|
|
61
|
-
readonly deleted: number;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* `true` when a working-tree file exists at `absPath` but its blob content
|
|
65
|
-
* hash differs from `expectedId`. An absent file is not dirty. Shared by
|
|
66
|
-
* `applySparseCheckout`'s narrowing pre-scan (design §9).
|
|
67
|
-
*/
|
|
68
|
-
declare const isWorkingTreeDirty: (ctx: Context, absPath: string, expectedId: string) => Promise<boolean>;
|
|
69
|
-
declare const applyChangeset: (ctx: Context, opts: ApplyChangesetOpts) => Promise<ApplyChangesetResult>;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Project a target tree onto a fresh stage-0 IndexEntry list, preserving
|
|
73
|
-
* stat-cache fields from the prior index where the path's `id` AND `mode`
|
|
74
|
-
* both match (the "stat-cache donor" strategy).
|
|
75
|
-
*
|
|
76
|
-
* Pure with respect to the working tree: this primitive never calls
|
|
77
|
-
* `fs.lstat`, `fs.read`, or any working-tree-side API. It only reads git
|
|
78
|
-
* objects via `walkTree` → `readObject` for nested trees.
|
|
79
|
-
*
|
|
80
|
-
* Used by `reset --mixed` to rebuild the index from a target
|
|
81
|
-
* commit's tree. Will be re-used by `reset --hard` composed
|
|
82
|
-
* with `materializeTree` to also write the working tree.
|
|
83
|
-
*
|
|
84
|
-
* ## Preconditions
|
|
85
|
-
*
|
|
86
|
-
* `currentIndex` MUST be read under the same `acquireIndexLock` that will
|
|
87
|
-
* later commit the result. Reading the index BEFORE the lock is acquired
|
|
88
|
-
* lets a concurrent writer mutate it between the donor-map build and the
|
|
89
|
-
* commit, producing a result that reflects neither the pre-reset nor the
|
|
90
|
-
* post-reset state. See `reset.ts:rebuildIndexFromCommit` for the
|
|
91
|
-
* canonical pattern: acquire → read → build → commit → release-in-finally.
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
interface BuildIndexFromTreeOpts {
|
|
95
|
-
readonly targetTree: ObjectId;
|
|
96
|
-
readonly currentIndex: GitIndex;
|
|
97
|
-
/**
|
|
98
|
-
* Sparse-checkout filter. When supplied, an excluded path is rebuilt as a
|
|
99
|
-
* zero-stat skip-worktree entry and an in-pattern path has any stale
|
|
100
|
-
* skip-worktree bit cleared. `undefined` ⇒ sparse inactive — the rebuilt
|
|
101
|
-
* index is byte-identical to the non-sparse behaviour.
|
|
102
|
-
*/
|
|
103
|
-
readonly sparse?: SparseMatcher;
|
|
104
|
-
}
|
|
105
|
-
declare const buildIndexFromTree: (ctx: Context, opts: BuildIndexFromTreeOpts) => Promise<ReadonlyArray<IndexEntry>>;
|
|
106
|
-
|
|
107
|
-
interface BuildPackInput {
|
|
108
|
-
readonly oids: ReadonlyArray<ObjectId>;
|
|
109
|
-
}
|
|
110
|
-
interface BuildPackResult {
|
|
111
|
-
readonly bytes: Uint8Array;
|
|
112
|
-
/** Hex SHA of the pack body, also the trailer (last 20 bytes). */
|
|
113
|
-
readonly sha: string;
|
|
114
|
-
readonly objectCount: number;
|
|
115
|
-
}
|
|
116
|
-
declare const buildPack: (ctx: Context, input: BuildPackInput) => Promise<BuildPackResult>;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Single source of truth for "is this index entry dirty in the working tree?".
|
|
120
|
-
*
|
|
121
|
-
* Compares the working file at `entry.path` against the entry's `(id, mode)`:
|
|
122
|
-
* `absent` when no working file exists, `modified` when the derived working
|
|
123
|
-
* mode or the content hash differs, else `unchanged`. Content is hashed via the
|
|
124
|
-
* uncapped `serializeAndHash` core (never the size-capped `hashBlob` write path),
|
|
125
|
-
* so a read-only comparison never throws on a large working file. Symlink
|
|
126
|
-
* content is its target (`readlink`), not the followed file.
|
|
127
|
-
*
|
|
128
|
-
* Consumed by `status` (reporting) and `rm` (the local-modification valve).
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
type WorkingTreeComparison = 'absent' | 'unchanged' | 'modified';
|
|
132
|
-
declare const compareWorkingTreeEntry: (ctx: Context, entry: IndexEntry) => Promise<WorkingTreeComparison>;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Subset of `.git/config` that v1 commands consume. Only fields actually used by
|
|
136
|
-
* commands are typed — the parser ignores everything else (lenient, like git itself).
|
|
137
|
-
*/
|
|
138
|
-
interface ParsedConfig {
|
|
139
|
-
readonly core?: {
|
|
140
|
-
readonly bare?: boolean;
|
|
141
|
-
readonly excludesFile?: string;
|
|
142
|
-
readonly logAllRefUpdates?: boolean | 'always';
|
|
143
|
-
readonly hooksPath?: string;
|
|
144
|
-
readonly sparseCheckout?: boolean;
|
|
145
|
-
readonly sparseCheckoutCone?: boolean;
|
|
146
|
-
};
|
|
147
|
-
readonly user?: {
|
|
148
|
-
readonly name: string;
|
|
149
|
-
readonly email: string;
|
|
150
|
-
};
|
|
151
|
-
readonly remote?: ReadonlyMap<string, {
|
|
152
|
-
readonly url?: string;
|
|
153
|
-
/** `remote.<name>.pushurl` — push-only URL; `push` reads `pushUrl ?? url`. */
|
|
154
|
-
readonly pushUrl?: string;
|
|
155
|
-
readonly fetch?: ReadonlyArray<string>;
|
|
156
|
-
/** `remote.<name>.promisor` — true when this is a partial-clone promisor remote. */
|
|
157
|
-
readonly promisor?: boolean;
|
|
158
|
-
/** `remote.<name>.partialclonefilter` — the canonical filter spec applied at clone. */
|
|
159
|
-
readonly partialCloneFilter?: string;
|
|
160
|
-
}>;
|
|
161
|
-
readonly branch?: ReadonlyMap<string, {
|
|
162
|
-
readonly remote?: string;
|
|
163
|
-
readonly merge?: string;
|
|
164
|
-
}>;
|
|
165
|
-
/** `[extensions]` — `partialClone` names the promisor remote of a partial clone. */
|
|
166
|
-
readonly extensions?: {
|
|
167
|
-
readonly partialClone?: string;
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Read and cache `${gitDir}/config`. Missing → empty config (not an error).
|
|
172
|
-
*
|
|
173
|
-
* The cache is keyed on `Context` identity; a new context (e.g., after a write
|
|
174
|
-
* that re-creates the repo) gets a fresh read. Concurrent calls share the same
|
|
175
|
-
* in-flight promise (per-context single-flight).
|
|
176
|
-
*/
|
|
177
|
-
declare const readConfig: (ctx: Context) => Promise<ParsedConfig>;
|
|
178
|
-
/**
|
|
179
|
-
* Drop the cached `readConfig` entry for a single `Context`. The production
|
|
180
|
-
* invalidator: a config write (`updateCoreConfig`) calls this so a subsequent
|
|
181
|
-
* `readConfig` on the same context re-reads the file instead of serving the
|
|
182
|
-
* stale parse.
|
|
183
|
-
*/
|
|
184
|
-
declare const invalidateConfigCache: (ctx: Context) => void;
|
|
185
|
-
/**
|
|
186
|
-
* One `[section "subsection"]` block of a git-config-format INI file: the
|
|
187
|
-
* section name, an optional quoted subsection, and its key/value entries.
|
|
188
|
-
* Exported so `.gitmodules` parsing — byte-identical grammar — reuses one
|
|
189
|
-
* tokenizer (ADR-086).
|
|
190
|
-
*/
|
|
191
|
-
interface IniSection {
|
|
192
|
-
readonly section: string;
|
|
193
|
-
readonly subsection: string | undefined;
|
|
194
|
-
readonly entries: ReadonlyArray<{
|
|
195
|
-
readonly key: string;
|
|
196
|
-
readonly value: string;
|
|
197
|
-
}>;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Tokenize git-config-format INI text into its sections. Lenient, like git:
|
|
201
|
-
* orphan and malformed lines are skipped; comments and backslash
|
|
202
|
-
* continuations are honored.
|
|
203
|
-
*/
|
|
204
|
-
declare const parseIniSections: (text: string) => ReadonlyArray<IniSection>;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Drop the per-scope sections cache for a single `Context`. Called by
|
|
208
|
-
* `invalidateConfigCache` in `config-read.ts` so writers can invalidate both
|
|
209
|
-
* caches atomically.
|
|
210
|
-
*/
|
|
211
|
-
declare const invalidateScopedConfigCache: (ctx: Context) => void;
|
|
212
|
-
/**
|
|
213
|
-
* Read the raw IniSection array for a single config scope, or a scope-tagged
|
|
214
|
-
* flat array merged in precedence order (`system → global → local → worktree`)
|
|
215
|
-
* when `scope` is omitted.
|
|
216
|
-
*
|
|
217
|
-
* Per-Context, per-scope cached: a second call with the same `(ctx, scope)`
|
|
218
|
-
* shares the in-flight promise of the first. `invalidateConfigCache(ctx)` (from
|
|
219
|
-
* `config-read.ts`) drops the cached entries here too.
|
|
220
|
-
*
|
|
221
|
-
* In the merged-read path (`scope` omitted), scopes that are unavailable on
|
|
222
|
-
* the current adapter (`CONFIG_SCOPE_NOT_AVAILABLE`, `CONFIG_SYSTEM_PATH_UNRESOLVED`)
|
|
223
|
-
* are silently skipped — the caller gets whatever scopes the adapter can
|
|
224
|
-
* actually surface. Single-scope calls raise instead, so the caller can react
|
|
225
|
-
* to a missing scope explicitly.
|
|
226
|
-
*/
|
|
227
|
-
declare const readConfigSections: ({ ctx, scope, }: {
|
|
228
|
-
readonly ctx: Context;
|
|
229
|
-
readonly scope?: ConfigScope;
|
|
230
|
-
}) => Promise<ReadonlyArray<{
|
|
231
|
-
readonly scope: ConfigScope;
|
|
232
|
-
readonly section: IniSection;
|
|
233
|
-
}>>;
|
|
234
|
-
/**
|
|
235
|
-
* Look up a single value for a fully-qualified key (`section.name` or
|
|
236
|
-
* `section.subsection.name`). Behaviour:
|
|
237
|
-
*
|
|
238
|
-
* - When `scope` is provided, reads only that scope. If the key has more than
|
|
239
|
-
* one match in that scope, throws `CONFIG_MULTIPLE_VALUES` (carries `scope`).
|
|
240
|
-
* - When `scope` is omitted, merges across the four scopes. Same multi-value
|
|
241
|
-
* throw if more than one entry matches anywhere across the merged view
|
|
242
|
-
* (without the `scope` discriminator).
|
|
243
|
-
* - Absent key: returns `{ key, value: undefined }`; never throws.
|
|
244
|
-
*
|
|
245
|
-
* Branding: the returned `key` is the caller's input cast to `ConfigKey`;
|
|
246
|
-
* `parseConfigKey` validates the string before this cast, so the brand is
|
|
247
|
-
* load-bearing only at the type level.
|
|
248
|
-
*/
|
|
249
|
-
declare const getConfigValue: ({ ctx, key, scope, }: {
|
|
250
|
-
readonly ctx: Context;
|
|
251
|
-
readonly key: string;
|
|
252
|
-
readonly scope?: ConfigScope;
|
|
253
|
-
}) => Promise<{
|
|
254
|
-
readonly key: ConfigKey;
|
|
255
|
-
readonly value: string;
|
|
256
|
-
readonly scope: ConfigScope;
|
|
257
|
-
} | {
|
|
258
|
-
readonly key: ConfigKey;
|
|
259
|
-
readonly value: undefined;
|
|
260
|
-
}>;
|
|
261
|
-
/**
|
|
262
|
-
* Look up every value for a key. Returns matches in scope-precedence order
|
|
263
|
-
* (and physical-file order within each scope). Empty array when the key is
|
|
264
|
-
* absent. Never throws on multi-value.
|
|
265
|
-
*/
|
|
266
|
-
declare const getAllConfigValues: ({ ctx, key, scope, }: {
|
|
267
|
-
readonly ctx: Context;
|
|
268
|
-
readonly key: string;
|
|
269
|
-
readonly scope?: ConfigScope;
|
|
270
|
-
}) => Promise<{
|
|
271
|
-
readonly key: ConfigKey;
|
|
272
|
-
readonly values: ReadonlyArray<{
|
|
273
|
-
readonly value: string;
|
|
274
|
-
readonly scope: ConfigScope;
|
|
275
|
-
}>;
|
|
276
|
-
}>;
|
|
277
|
-
|
|
278
|
-
interface EnumeratePushObjectsInput {
|
|
279
|
-
/**
|
|
280
|
-
* Object ids the caller wants on the remote. Each MUST resolve to a
|
|
281
|
-
* commit or an annotated tag (tags are unwrapped to commits before the
|
|
282
|
-
* commit walk).
|
|
283
|
-
*/
|
|
284
|
-
readonly wants: ReadonlyArray<ObjectId>;
|
|
285
|
-
/** Object ids the remote already has (server's advertised ref tips). */
|
|
286
|
-
readonly haves: ReadonlyArray<ObjectId>;
|
|
287
|
-
/** Hard cap on objects emitted. Defaults to MAX_PUSH_OBJECTS. */
|
|
288
|
-
readonly maxObjects?: number;
|
|
289
|
-
}
|
|
290
|
-
declare function enumeratePushObjects(ctx: Context, input: EnumeratePushObjectsInput): AsyncIterable<ObjectId>;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Enumerate every current ref: `HEAD`, loose refs under `.git/refs/**`, and
|
|
294
|
-
* packed-refs entries — deduplicated. Used by `reflog expire` to seed the
|
|
295
|
-
* reachable-commit walk; not on any hot path.
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
declare function enumerateRefs(ctx: Context): Promise<ReadonlyArray<RefName>>;
|
|
299
|
-
|
|
300
|
-
interface FetchPackInput {
|
|
301
|
-
/** Advertised refs the caller wants. MUST be non-empty (server-side requirement). */
|
|
302
|
-
readonly wants: ReadonlyArray<ObjectId>;
|
|
303
|
-
/** Objects the caller already has (negotiation). Empty for clone, populated for fetch. */
|
|
304
|
-
readonly haves: ReadonlyArray<ObjectId>;
|
|
305
|
-
/** Negotiated capabilities (intersection of advertised + supported). */
|
|
306
|
-
readonly capabilities: ReadonlyArray<string>;
|
|
307
|
-
/** Base remote URL (the same URL passed to clone). */
|
|
308
|
-
readonly url: string;
|
|
309
|
-
/** Progress op label — clone uses 'clone:write-objects', fetch uses 'fetch:write-objects'. */
|
|
310
|
-
readonly progressOp: string;
|
|
311
|
-
/**
|
|
312
|
-
* Shallow clone depth. When set, sends `deepen N` and consumes the
|
|
313
|
-
* accompanying `shallow <oid>` / `unshallow <oid>` response block.
|
|
314
|
-
*
|
|
315
|
-
*/
|
|
316
|
-
readonly depth?: number;
|
|
317
|
-
/**
|
|
318
|
-
* Partial-clone object filter — a canonical filter spec. When set, a
|
|
319
|
-
* `filter` line is emitted; the caller must have negotiated the `filter`
|
|
320
|
-
* capability.
|
|
321
|
-
*/
|
|
322
|
-
readonly filter?: string;
|
|
323
|
-
/**
|
|
324
|
-
* When true, write an empty `pack-<sha>.promisor` sentinel beside the pack
|
|
325
|
-
* so the objects it references but omits are treated as promised.
|
|
326
|
-
*/
|
|
327
|
-
readonly promisor?: boolean;
|
|
328
|
-
}
|
|
329
|
-
interface FetchPackResult {
|
|
330
|
-
readonly packPath: string;
|
|
331
|
-
readonly idxPath: string;
|
|
332
|
-
readonly objectCount: number;
|
|
333
|
-
/** Hex-encoded SHA of the pack trailer; also the on-disk filename stem. */
|
|
334
|
-
readonly packSha: string;
|
|
335
|
-
/** Commits the server advertised as new shallow boundaries (empty when depth is unset). */
|
|
336
|
-
readonly shallow: ReadonlyArray<ObjectId>;
|
|
337
|
-
/** Commits the server advertised as no-longer-shallow (empty when depth is unset). */
|
|
338
|
-
readonly unshallow: ReadonlyArray<ObjectId>;
|
|
339
|
-
}
|
|
340
|
-
declare const fetchPack: (ctx: Context, transport: HttpTransport, input: FetchPackInput) => Promise<FetchPackResult>;
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Flatten a nested `Tree` object into the `FlatTree` shape that the
|
|
344
|
-
* `mergeTrees` domain primitive consumes.
|
|
345
|
-
*
|
|
346
|
-
* Bridges `walkTree`'s iterator into the `FlatTree` Map of
|
|
347
|
-
* `path → { id, mode }`. Consumed by `merge.ts`'s clean-merge tree walk
|
|
348
|
-
* and by `rm`'s HEAD-vs-index staged-change check (the safety valve), so
|
|
349
|
-
* it is exported from the primitives barrel.
|
|
350
|
-
*
|
|
351
|
-
* Pure with respect to the working tree — only reads git objects via
|
|
352
|
-
* `walkTree`.
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
declare const flattenTree: (ctx: Context, treeId: ObjectId) => Promise<FlatTree>;
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Compose `walkTree → computeChangeset → applyChangeset` to update the
|
|
359
|
-
* working tree to a target tree's contents.
|
|
360
|
-
*
|
|
361
|
-
* - Branch switch mode: `paths === undefined` — diff the entire current
|
|
362
|
-
* index against the entire target tree.
|
|
363
|
-
* - Path-restore mode: `paths !== undefined` — restrict both sides of
|
|
364
|
-
* the diff to those paths.
|
|
365
|
-
*
|
|
366
|
-
* Returns the new IndexEntry list for the caller to commit, plus
|
|
367
|
-
* written/deleted counts. The primitive does NOT commit the index — the
|
|
368
|
-
* caller decides.
|
|
369
|
-
*
|
|
370
|
-
* ## Stat-source contract for `newIndexEntries` (load-bearing for)
|
|
371
|
-
*
|
|
372
|
-
* - **Paths that were written/added** (`add` or `update` changeset entries):
|
|
373
|
-
* the IndexEntry carries **post-write `lstat`-derived stat fields**
|
|
374
|
-
* (ctime/mtime/dev/ino/uid/gid/fileSize). These reflect the file we just
|
|
375
|
-
* wrote, so the next `status` runs the fast `isStatClean` path.
|
|
376
|
-
* - **Paths whose changeset classification was `noop`** (skipped — index
|
|
377
|
-
* already matched target by `id + mode`): the IndexEntry is the caller's
|
|
378
|
-
* `currentIndex` entry verbatim. Donor stats survive across the call.
|
|
379
|
-
* - `reset --hard` therefore MUST set `forceRewriteAll: true` so every noop
|
|
380
|
-
* upgrades to update and the post-write stats land in the output. Without
|
|
381
|
-
* that, a locally-modified working-tree file that the index still records
|
|
382
|
-
* as clean would survive the reset, AND the donor stats would be stale
|
|
383
|
-
* relative to the actual disk state.
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
interface MaterializeTreeOpts {
|
|
387
|
-
readonly targetTree: ObjectId;
|
|
388
|
-
readonly currentIndex: GitIndex;
|
|
389
|
-
readonly force?: boolean;
|
|
390
|
-
readonly paths?: ReadonlySet<FilePath>;
|
|
391
|
-
/**
|
|
392
|
-
* When true, every target-tree path is written to the working tree
|
|
393
|
-
* unconditionally — even paths the index→target diff classified as `noop`
|
|
394
|
-
* (same `id` AND `mode`). Required by `reset --hard`, where the working
|
|
395
|
-
* tree may diverge from the index (uncommitted local modifications); the
|
|
396
|
-
* standard index→target diff cannot see that drift, so noops would skip
|
|
397
|
-
* paths the caller wants overwritten. Default `false` keeps the Phase
|
|
398
|
-
* 13.1 checkout behaviour: clean files are never spuriously rewritten.
|
|
399
|
-
*/
|
|
400
|
-
readonly forceRewriteAll?: boolean;
|
|
401
|
-
/**
|
|
402
|
-
* Branch-switch sparse-checkout filter. Honoured ONLY when `paths` is
|
|
403
|
-
* undefined. A target-tree path the matcher rejects is NOT written to the
|
|
404
|
-
* working tree; its `newIndexEntries` record carries `skipWorktree: true`
|
|
405
|
-
* (the index keeps every path — git-faithful). A path the matcher accepts
|
|
406
|
-
* that the *current* index records as skip-worktree (absent on disk) is
|
|
407
|
-
* materialised even when its `id` matches, because the current index is
|
|
408
|
-
* filtered to drop skip-worktree entries before the diff — such a path
|
|
409
|
-
* classifies as `add`, never `noop`.
|
|
410
|
-
*/
|
|
411
|
-
readonly sparse?: SparseMatcher;
|
|
412
|
-
}
|
|
413
|
-
interface MaterializeTreeResult {
|
|
414
|
-
readonly newIndexEntries: ReadonlyArray<IndexEntry>;
|
|
415
|
-
readonly written: number;
|
|
416
|
-
readonly deleted: number;
|
|
417
|
-
}
|
|
418
|
-
declare const materializeTree: (ctx: Context, opts: MaterializeTreeOpts) => Promise<MaterializeTreeResult>;
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Hard cap on the `.git/info/sparse-checkout` file — 1 MiB, mirroring
|
|
422
|
-
* `MAX_GITIGNORE_BYTES`. A plain literal (not `1024 * 1024`) so a boundary test
|
|
423
|
-
* keyed on the constant cannot drift with an arithmetic mutation of it.
|
|
424
|
-
*/
|
|
425
|
-
declare const MAX_SPARSE_PATTERN_FILE_BYTES = 1048576;
|
|
426
|
-
/**
|
|
427
|
-
* Read `.git/info/sparse-checkout` as UTF-8 text. An absent file yields
|
|
428
|
-
* `undefined`; a file whose byte length exceeds
|
|
429
|
-
* `MAX_SPARSE_PATTERN_FILE_BYTES` throws `SPARSE_PATTERN_FILE_TOO_LARGE`
|
|
430
|
-
* (checked before decode so an over-cap file never reaches the decoder).
|
|
431
|
-
*/
|
|
432
|
-
declare const readSparsePatternText: (ctx: Context) => Promise<string | undefined>;
|
|
433
|
-
/**
|
|
434
|
-
* Build the sparse matcher for the current repository. Returns `undefined`
|
|
435
|
-
* when `core.sparseCheckout` is falsy/absent — sparse is inactive and callers
|
|
436
|
-
* behave exactly as a non-sparse repo. When active, the matcher is parsed in
|
|
437
|
-
* the mode `core.sparseCheckoutCone` dictates; a cone file that degrades to
|
|
438
|
-
* non-cone matching logs one warning.
|
|
439
|
-
*/
|
|
440
|
-
declare const loadSparseMatcher: (ctx: Context) => Promise<SparseMatcher | undefined>;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Committer identity for reflog entries: config `user.*` plus a fresh
|
|
444
|
-
* timestamp, or a portable fallback when `user.*` is unset. Never throws —
|
|
445
|
-
* reflog logging must not abort a ref update.
|
|
446
|
-
*/
|
|
447
|
-
declare function resolveReflogIdentity(ctx: Context): Promise<AuthorIdentity>;
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Thin I/O layer over `.git/logs/<ref>` reflog files. Append is the hot path;
|
|
451
|
-
* whole-file rewrite and delete back the `reflog` command's expire / delete.
|
|
452
|
-
*/
|
|
453
|
-
|
|
454
|
-
/** Append one entry to `ref`'s reflog, creating the file and parents as needed. */
|
|
455
|
-
declare function appendReflog(ctx: Context, ref: RefName, entry: ReflogEntry): Promise<void>;
|
|
456
|
-
/** Read `ref`'s reflog, oldest-first. Returns `[]` when the file is absent. */
|
|
457
|
-
declare function readReflog(ctx: Context, ref: RefName): Promise<ReadonlyArray<ReflogEntry>>;
|
|
458
|
-
/** Whether `ref` has a reflog file at all. */
|
|
459
|
-
declare function reflogExists(ctx: Context, ref: RefName): Promise<boolean>;
|
|
460
|
-
/** Replace `ref`'s reflog with exactly `entries`. Used by expire / delete. */
|
|
461
|
-
declare function writeReflog(ctx: Context, ref: RefName, entries: ReadonlyArray<ReflogEntry>): Promise<void>;
|
|
462
|
-
/** Remove `ref`'s reflog file. A no-op when the file is already absent. */
|
|
463
|
-
declare function deleteReflog(ctx: Context, ref: RefName): Promise<void>;
|
|
464
|
-
/** Every reflog under `.git/logs/`, each as the `RefName` it logs. */
|
|
465
|
-
declare function listReflogs(ctx: Context): Promise<ReadonlyArray<RefName>>;
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Read `.git/shallow`. Returns an empty set when the file does not exist or
|
|
469
|
-
* contains no oids. Malformed lines are tolerated (skipped) — canonical
|
|
470
|
-
* git behaves the same; a corrupted shallow file should not block a fetch.
|
|
471
|
-
*/
|
|
472
|
-
declare const readShallow: (ctx: Context) => Promise<ReadonlySet<ObjectId>>;
|
|
473
|
-
interface ShallowUpdate {
|
|
474
|
-
readonly shallow: ReadonlyArray<ObjectId>;
|
|
475
|
-
readonly unshallow: ReadonlyArray<ObjectId>;
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Apply a set of shallow / unshallow updates to `.git/shallow`. Writes
|
|
479
|
-
* atomically via lock-rename; deletes the file when the resulting set is
|
|
480
|
-
* empty.
|
|
481
|
-
*/
|
|
482
|
-
declare const updateShallow: (ctx: Context, updates: ShallowUpdate) => Promise<void>;
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Synthesise a nested `Tree` object from a flat `GitIndex` and return the
|
|
486
|
-
* root tree's `ObjectId`. Sub-trees are written to the object store as a
|
|
487
|
-
* side-effect of the recursive descent — only stage-0 entries contribute.
|
|
488
|
-
*
|
|
489
|
-
* Used by `checkout({ paths, source: 'index' })` to restore
|
|
490
|
-
* the working tree from staged content even when the index has diverged
|
|
491
|
-
* from HEAD via `add` / `rm`. The previous placeholder fell back to
|
|
492
|
-
* HEAD's tree, which silently lost the divergence.
|
|
493
|
-
*
|
|
494
|
-
* The synthesis is the inverse of `buildIndexFromTree`:
|
|
495
|
-
* "tree → index" and "index → tree" form a round-trip identity for any
|
|
496
|
-
* stage-0-only index.
|
|
497
|
-
*
|
|
498
|
-
* Pure with respect to the working tree — never calls `fs.lstat`,
|
|
499
|
-
* `fs.read`, or any working-tree-side API. Only writes git objects via
|
|
500
|
-
* the existing `writeTree` primitive.
|
|
501
|
-
*
|
|
502
|
-
* ## Safety
|
|
503
|
-
*
|
|
504
|
-
* - **Path validation**:.7 hoisted segment-level validation into
|
|
505
|
-
* `parseIndex` (`src/domain/git-index/path-validator.ts`). Every
|
|
506
|
-
* `IndexEntry` reaching this primitive THROUGH THE CANONICAL PARSER
|
|
507
|
-
* carries a `FilePath` value already free of `..`, `.`, empty segments,
|
|
508
|
-
* and leading-slash absolute paths. However, the primitive is also
|
|
509
|
-
* reachable from callers that construct `IndexEntry` records outside
|
|
510
|
-
* the parser (test fixtures, in-memory adapters, future synthesisers).
|
|
511
|
-
* Defence-in-depth: every entry is re-validated here so the primitive
|
|
512
|
-
* stays safe even when the parser-trusted path is bypassed.
|
|
513
|
-
* - **Depth cap**: synthesis bounds recursion at `MAX_TREE_DEPTH` (4096,
|
|
514
|
-
* matching git's canonical limit). The cap is enforced at the input
|
|
515
|
-
* boundary by counting slashes — by the time recursion would catch a
|
|
516
|
-
* pathological depth, the JS engine has already exhausted its call
|
|
517
|
-
* stack. Path validation does NOT subsume this check: a path can be
|
|
518
|
-
* safe segment-by-segment (no `..`/`.`/empty) and still be 10 000
|
|
519
|
-
* levels deep.
|
|
520
|
-
*/
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Public entry: pass the `entries` array directly (typically
|
|
524
|
-
* `index.entries`, but callers holding a filtered list may supply it
|
|
525
|
-
* without wrapping in a fake `GitIndex`).
|
|
526
|
-
*/
|
|
527
|
-
declare const synthesizeTreeFromIndex: (ctx: Context, entries: ReadonlyArray<IndexEntry>) => Promise<ObjectId>;
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Targeted `.git/config` writer (ADR-082). tsgit has no general INI writer;
|
|
531
|
-
* this performs line surgery that preserves comments, blank lines, key order,
|
|
532
|
-
* casing of unrelated keys, and every other section byte-for-byte. It writes
|
|
533
|
-
* one `key = value` per call under any `[section]` / `[section "subsection"]`.
|
|
534
|
-
*
|
|
535
|
-
* @writes
|
|
536
|
-
* surface: config
|
|
537
|
-
* kind: readback-only
|
|
538
|
-
* format: git-config-text
|
|
539
|
-
*/
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Set `key` under `[section]` / `[section "subsection"]`, preserving every
|
|
543
|
-
* other byte verbatim.
|
|
544
|
-
*
|
|
545
|
-
* - existing section with that key ⇒ its value is replaced;
|
|
546
|
-
* - existing section without that key ⇒ a `\t<key> = <value>` line is
|
|
547
|
-
* inserted right after the header;
|
|
548
|
-
* - no such section ⇒ `[section]\n\t<key> = <value>\n` is appended.
|
|
549
|
-
*/
|
|
550
|
-
declare const setConfigEntryInText: (text: string, section: string, subsection: string | undefined, key: string, value: string) => string;
|
|
551
|
-
/** `setConfigEntryInText` bound to the `[core]` section — kept for legacy callers. */
|
|
552
|
-
declare const setCoreConfigEntryInText: (text: string, key: string, value: string) => string;
|
|
553
|
-
/** One `key = value` write under `[section]` / `[section "subsection"]`. */
|
|
554
|
-
interface ConfigEntry {
|
|
555
|
-
readonly section: string;
|
|
556
|
-
readonly subsection?: string;
|
|
557
|
-
readonly key: string;
|
|
558
|
-
readonly value: string;
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Read `${gitDir}/config` (a missing file is treated as `''`), fold
|
|
562
|
-
* `setConfigEntryInText` over `entries`, write the result, and invalidate the
|
|
563
|
-
* per-`Context` `readConfig` cache so a later read sees the new values.
|
|
564
|
-
*/
|
|
565
|
-
declare const updateConfigEntries: (ctx: Context, entries: ReadonlyArray<ConfigEntry>) => Promise<void>;
|
|
566
|
-
/** Fold a batch of `[core]` `key = value` writes via `updateConfigEntries`. */
|
|
567
|
-
declare const updateCoreConfig: (ctx: Context, entries: Record<string, string>) => Promise<void>;
|
|
568
|
-
/**
|
|
569
|
-
* Mixed-operation batch entry. Folded over the on-disk text in order in
|
|
570
|
-
* a single `writeUtf8`. Use this when `remote` CRUD needs a section-
|
|
571
|
-
* remove paired with branch-referrer key removals in one atomic write.
|
|
572
|
-
*/
|
|
573
|
-
type ConfigOperation = {
|
|
574
|
-
readonly kind: 'set';
|
|
575
|
-
readonly section: string;
|
|
576
|
-
readonly subsection?: string;
|
|
577
|
-
readonly key: string;
|
|
578
|
-
readonly value: string;
|
|
579
|
-
} | {
|
|
580
|
-
/**
|
|
581
|
-
* Insert a fresh `key = value` line after the section header WITHOUT
|
|
582
|
-
* replacing any existing entry with the same key. Use for multi-value
|
|
583
|
-
* keys (`fetch`) where every call must yield an additional line.
|
|
584
|
-
*/
|
|
585
|
-
readonly kind: 'appendEntry';
|
|
586
|
-
readonly section: string;
|
|
587
|
-
readonly subsection?: string;
|
|
588
|
-
readonly key: string;
|
|
589
|
-
readonly value: string;
|
|
590
|
-
} | {
|
|
591
|
-
readonly kind: 'removeEntry';
|
|
592
|
-
readonly section: string;
|
|
593
|
-
readonly subsection?: string;
|
|
594
|
-
readonly key: string;
|
|
595
|
-
} | {
|
|
596
|
-
readonly kind: 'removeSection';
|
|
597
|
-
readonly section: string;
|
|
598
|
-
readonly subsection?: string;
|
|
599
|
-
} | {
|
|
600
|
-
readonly kind: 'renameSection';
|
|
601
|
-
readonly section: string;
|
|
602
|
-
readonly from: string;
|
|
603
|
-
readonly to: string;
|
|
604
|
-
};
|
|
605
|
-
declare const applyConfigOpInText: (text: string, op: ConfigOperation) => string;
|
|
606
|
-
/**
|
|
607
|
-
* Write a single `key = value` entry into the config file for the given scope
|
|
608
|
-
* (default `'local'`). Re-runs of the same call with a different value
|
|
609
|
-
* overwrite the existing entry in place (preserving comments and surrounding
|
|
610
|
-
* content). The key is validated via `parseConfigKey` (throws
|
|
611
|
-
* `CONFIG_KEY_INVALID` on a malformed input) and the value is validated by
|
|
612
|
-
* `assertValueSafe` (throws `CONFIG_VALUE_INVALID` on a banned control char)
|
|
613
|
-
* BEFORE any I/O — a rejected input never touches the file system.
|
|
614
|
-
*
|
|
615
|
-
* The branding on `ConfigKey` is enforced at the type level; this primitive
|
|
616
|
-
* accepts a raw string and parses it internally so it can be used directly
|
|
617
|
-
* from porcelain wrappers that hold un-branded callers' input.
|
|
618
|
-
*/
|
|
619
|
-
declare const setConfigEntry: ({ ctx, key, value, scope, }: {
|
|
620
|
-
readonly ctx: Context;
|
|
621
|
-
readonly key: string;
|
|
622
|
-
readonly value: string;
|
|
623
|
-
readonly scope?: ConfigScope;
|
|
624
|
-
}) => Promise<void>;
|
|
625
|
-
/**
|
|
626
|
-
* Remove a single `key = value` entry from the given scope. Idempotent — if
|
|
627
|
-
* the key is absent the call is a no-op (no I/O). If the key appears more
|
|
628
|
-
* than once in the targeted scope, throws `CONFIG_MULTIPLE_VALUES` with
|
|
629
|
-
* `requested: 'remove'` (the caller should use `unsetAllConfigEntries` to
|
|
630
|
-
* clear every occurrence).
|
|
631
|
-
*/
|
|
632
|
-
declare const unsetConfigEntry: ({ ctx, key, scope, }: {
|
|
633
|
-
readonly ctx: Context;
|
|
634
|
-
readonly key: string;
|
|
635
|
-
readonly scope?: ConfigScope;
|
|
636
|
-
}) => Promise<void>;
|
|
637
|
-
/**
|
|
638
|
-
* Remove every occurrence of `key` from the targeted scope. Idempotent — a
|
|
639
|
-
* missing key produces no I/O. Unlike `unsetConfigEntry`, multi-valued keys
|
|
640
|
-
* are explicitly supported: all matching lines are removed in a single
|
|
641
|
-
* read-modify-write pass.
|
|
642
|
-
*/
|
|
643
|
-
declare const unsetAllConfigEntries: ({ ctx, key, scope, }: {
|
|
644
|
-
readonly ctx: Context;
|
|
645
|
-
readonly key: string;
|
|
646
|
-
readonly scope?: ConfigScope;
|
|
647
|
-
}) => Promise<void>;
|
|
648
|
-
/**
|
|
649
|
-
* Rename `[<section> "<oldSubsection>"]` to `[<section> "<newSubsection>"]`.
|
|
650
|
-
* Both inputs are dotted (`'remote.origin'`). The two section families MUST
|
|
651
|
-
* match — renaming across families (e.g. `remote.origin` → `branch.main`) is
|
|
652
|
-
* rejected with `INVALID_OPTION`. Throws `CONFIG_SECTION_NOT_FOUND` if the
|
|
653
|
-
* source section does not exist in the targeted scope.
|
|
654
|
-
*/
|
|
655
|
-
declare const renameConfigSection: ({ ctx, oldName, newName, scope, }: {
|
|
656
|
-
readonly ctx: Context;
|
|
657
|
-
readonly oldName: string;
|
|
658
|
-
readonly newName: string;
|
|
659
|
-
readonly scope?: ConfigScope;
|
|
660
|
-
}) => Promise<void>;
|
|
661
|
-
/**
|
|
662
|
-
* Delete `[<section> "<subsection>"]` and its body. `sectionName` is dotted
|
|
663
|
-
* (`'remote.origin'`). Throws `CONFIG_SECTION_NOT_FOUND` when the section is
|
|
664
|
-
* absent in the targeted scope.
|
|
665
|
-
*/
|
|
666
|
-
declare const removeConfigSection: ({ ctx, sectionName, scope, }: {
|
|
667
|
-
readonly ctx: Context;
|
|
668
|
-
readonly sectionName: string;
|
|
669
|
-
readonly scope?: ConfigScope;
|
|
670
|
-
}) => Promise<void>;
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* Write the `.git/info/sparse-checkout` pattern file. The command tier
|
|
674
|
-
* computes the text (via `serializeCone` or raw non-cone lines); this
|
|
675
|
-
* primitive only persists it (design §7.3).
|
|
676
|
-
*
|
|
677
|
-
* @writes
|
|
678
|
-
* surface: sparseCheckoutFile
|
|
679
|
-
* kind: byte-identical
|
|
680
|
-
* format: git-sparse-checkout
|
|
681
|
-
*/
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Persist `text` to `.git/info/sparse-checkout`. The `.git/info` directory is
|
|
685
|
-
* created defensively first — `writeUtf8` creates parents on every adapter,
|
|
686
|
-
* but an explicit `mkdir` keeps the contract clear and survives adapters that
|
|
687
|
-
* tighten that guarantee.
|
|
688
|
-
*/
|
|
689
|
-
declare const writeSparsePatternText: (ctx: Context, text: string) => Promise<void>;
|
|
690
|
-
|
|
691
|
-
export { MAX_SPARSE_PATTERN_FILE_BYTES, appendReflog, applyChangeset, applyConfigOpInText, buildIndexFromTree, buildPack, compareWorkingTreeEntry, computeChangeset, deleteReflog, enumeratePushObjects, enumerateRefs, fetchPack, flattenTree, getAllConfigValues, getConfigValue, invalidateConfigCache, invalidateScopedConfigCache, isWorkingTreeDirty, listReflogs, loadSparseMatcher, materializeTree, parseIniSections, readConfig, readConfigSections, readReflog, readShallow, readSparsePatternText, reflogExists, removeConfigSection, renameConfigSection, resolveReflogIdentity, setConfigEntry, setConfigEntryInText, setCoreConfigEntryInText, synthesizeTreeFromIndex, unsetAllConfigEntries, unsetConfigEntry, updateConfigEntries, updateCoreConfig, updateShallow, writeReflog, writeSparsePatternText };
|
|
692
|
-
export type { ApplyChangesetOpts, ApplyChangesetResult, BuildIndexFromTreeOpts, BuildPackInput, BuildPackResult, Changeset, ChangesetEntry, ChangesetStats, ConfigEntry, EnumeratePushObjectsInput, FetchPackInput, FetchPackResult, IniSection, MaterializeTreeOpts, MaterializeTreeResult, ParsedConfig, WorkingTreeComparison };
|
|
1
|
+
export { A as ApplyChangesetOpts, a as ApplyChangesetResult, B as BlobStream, b as BuildIndexFromTreeOpts, c as BuildPackInput, d as BuildPackResult, C as Changeset, e as ChangesetEntry, f as ChangesetStats, g as ConfigEntry, D as DEFAULT_NOTES_REF, E as EnumerateObjectsOptions, h as EnumeratePushObjectsInput, F as FetchPackInput, i as FetchPackResult, H as HashBlobOptions, j as HookInput, I as IniSection, k as IsIgnoredMatch, l as IsIgnoredMatchSource, m as IsIgnoredQuery, L as LoadedNotesTree, M as MAX_SPARSE_PATTERN_FILE_BYTES, n as MaterializeTreeOpts, o as MaterializeTreeResult, p as MergeBaseOptions, P as ParsedConfig, q as PushDefaultMode, S as SignPayloadResult, r as SignRequest, s as StreamBlobOptions, V as ValuelessEntry, W as WorkingTreeComparison, t as WorkingTreeDelta, u as WriteNotesTreeInput, v as appendReflog, w as applyChangeset, x as applyConfigOpInText, y as bisectMidpoint, z as buildIndexFromTree, G as buildPack, J as catFileBatch, K as compareWorkingTreeDelta, N as compareWorkingTreeEntry, O as computeChangeset, Q as createCommit, R as createTag, T as deleteReflog, U as diffTrees, X as enumerateObjects, Y as enumeratePushObjects, Z as enumerateRefs, _ as fetchPack, $ as findFirstValuelessEntry, a0 as flattenTree, a1 as getAllConfigValues, a2 as getConfigValue, a3 as getRepoRoot, a4 as hasObject, a5 as hashBlob, a6 as invalidateConfigCache, a7 as invalidateScopedConfigCache, a8 as isIgnored, a9 as isWorkingTreeDirty, aa as listReflogs, ab as loadNotesTree, ac as loadSparseMatcher, ad as materializeTree, ae as materializeWorktreeFromHead, af as mergeBase, ag as parseIniSections, ah as readBlob, ai as readConfig, aj as readConfigSections, ak as readHeadTree, al as readIndex, am as readObject, an as readReflog, ao as readShallow, ap as readSparsePatternText, aq as readTree, ar as reflogExists, as as removeConfigSection, at as renameConfigSection, au as resolveNotesRef, av as resolveRef, aw as resolveReflogIdentity, ax as resolveSigningSelector, ay as runHook, az as runInformationalHook, aA as setConfigEntry, aB as setConfigEntryInText, aC as setCoreConfigEntryInText, aD as signPayload, aE as sparseCheckoutPath, aF as streamBlob, aG as synthesizeTreeFromIndex, aH as unsetAllConfigEntries, aI as unsetConfigEntry, aJ as updateConfigEntries, aK as updateCoreConfig, aL as updateRef, aM as updateShallow, aN as walkCommits, aO as walkCommitsByDate, aP as walkSubmodules, aQ as walkTree, aR as walkWorkingTree, aS as writeNotesTree, aT as writeObject, aU as writeReflog, aV as writeSparsePatternText, aW as writeTree } from '../chunks/index-Dqxddhav.cjs';
|
|
2
|
+
export { B as BisectMidpoint, C as CatFileBatchEntry, c as CatFileBatchOptions, g as CreateCommitInput, h as CreateTagInput, n as DiffTreesInput, o as DiffTreesOptions, M as MAX_COMMIT_MESSAGE_BYTES, v as MAX_GITATTRIBUTES_BYTES, w as MAX_GITIGNORE_BYTES, x as MAX_GITMODULES_BYTES, y as MAX_HAVES, z as MAX_INDEX_BYTES, H as MAX_PEEL_DEPTH, J as MAX_PUSH_OBJECTS, K as MAX_REFLOG_BYTES, O as MAX_SUBMODULE_DEPTH, P as MAX_SYMBOLIC_REF_DEPTH, Q as MAX_WALK_QUEUE_SIZE, R as MAX_WALK_SEEDS, S as MAX_WORKING_TREE_BLOB_BYTES, V as ReadObjectOptions, Y as ResolveRefOptions, a4 as SubmoduleEntry, a8 as TreeDiff, aa as UpdateRefOptions, ab as WalkCommitsByDateOptions, ac as WalkCommitsOptions, aS as WalkIgnorePredicate, ad as WalkSubmodulesOptions, ae as WalkTreeEntry, af as WalkTreeOptions, ag as WalkWorkingTreeEntry, ah as WalkWorkingTreeOptions } from '../chunks/reflog-entry-Dy-O27Dd.cjs';
|
|
3
|
+
import '../chunks/context-CF1YF2S8.cjs';
|
|
4
|
+
import '../chunks/http-transport-DirKfK2S.cjs';
|