@scolladon/tsgit 1.1.0 → 1.3.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.
Files changed (119) hide show
  1. package/README.md +32 -252
  2. package/dist/cjs/adapters/browser/index.cjs +1 -1
  3. package/dist/cjs/adapters/memory/index.cjs +1 -1
  4. package/dist/cjs/adapters/memory/index.cjs.map +1 -1
  5. package/dist/cjs/adapters/node/index.cjs +1 -1
  6. package/dist/cjs/adapters/node/index.cjs.map +1 -1
  7. package/dist/cjs/chunks/browser-http-transport-D4NH-8oJ.cjs +2 -0
  8. package/dist/cjs/chunks/browser-http-transport-D4NH-8oJ.cjs.map +1 -0
  9. package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +1 -1
  10. package/dist/cjs/chunks/{error-CqLvhejR.cjs → error-CDLOBdNU.cjs} +2 -2
  11. package/dist/cjs/chunks/error-CDLOBdNU.cjs.map +1 -0
  12. package/dist/cjs/chunks/index-BVArBKuk.cjs +2 -0
  13. package/dist/cjs/chunks/index-BVArBKuk.cjs.map +1 -0
  14. package/dist/cjs/chunks/index-DE9HSiWf.cjs +2 -0
  15. package/dist/cjs/chunks/index-DE9HSiWf.cjs.map +1 -0
  16. package/dist/cjs/chunks/{logger-C8Z5BfFF.cjs → logger-CVG0zcPH.cjs} +2 -2
  17. package/dist/cjs/chunks/{logger-C8Z5BfFF.cjs.map → logger-CVG0zcPH.cjs.map} +1 -1
  18. package/dist/cjs/chunks/{memory-http-transport-Pjyme5KN.cjs → memory-http-transport-DXwDGKtR.cjs} +2 -2
  19. package/dist/cjs/chunks/memory-http-transport-DXwDGKtR.cjs.map +1 -0
  20. package/dist/cjs/chunks/node-http-transport-vrbnNEDb.cjs +2 -0
  21. package/dist/cjs/chunks/node-http-transport-vrbnNEDb.cjs.map +1 -0
  22. package/dist/cjs/chunks/{progress-CntEbiuo.cjs → progress-Bj2w-90A.cjs} +2 -2
  23. package/dist/cjs/chunks/{progress-CntEbiuo.cjs.map → progress-Bj2w-90A.cjs.map} +1 -1
  24. package/dist/cjs/chunks/repository-BJwTSiGf.cjs +2 -0
  25. package/dist/cjs/chunks/repository-BJwTSiGf.cjs.map +1 -0
  26. package/dist/cjs/commands/index.cjs +1 -1
  27. package/dist/cjs/index.browser.cjs +1 -1
  28. package/dist/cjs/index.cjs +1 -1
  29. package/dist/cjs/index.default.cjs +1 -1
  30. package/dist/cjs/index.node.cjs +1 -1
  31. package/dist/cjs/index.node.cjs.map +1 -1
  32. package/dist/cjs/primitives/index.cjs +1 -1
  33. package/dist/esm/adapters/browser/index.js +1 -1
  34. package/dist/esm/adapters/memory/index.js +1 -1
  35. package/dist/esm/adapters/memory/index.js.map +1 -1
  36. package/dist/esm/adapters/node/index.js +1 -1
  37. package/dist/esm/adapters/node/index.js.map +1 -1
  38. package/dist/esm/chunks/browser-http-transport-DL8bkNdg.js +2 -0
  39. package/dist/esm/chunks/browser-http-transport-DL8bkNdg.js.map +1 -0
  40. package/dist/esm/chunks/context-CumKOV7K.js.map +1 -1
  41. package/dist/esm/chunks/{error-BN9rdQ33.js → error-MOmSzp9Z.js} +2 -2
  42. package/dist/esm/chunks/error-MOmSzp9Z.js.map +1 -0
  43. package/dist/esm/chunks/index-BjmofbKE.js +2 -0
  44. package/dist/esm/chunks/index-BjmofbKE.js.map +1 -0
  45. package/dist/esm/chunks/index-Jh5R-UmU.js +2 -0
  46. package/dist/esm/chunks/index-Jh5R-UmU.js.map +1 -0
  47. package/dist/esm/chunks/{logger-BLZbLzva.js → logger-DP2cCpvL.js} +2 -2
  48. package/dist/esm/chunks/{logger-BLZbLzva.js.map → logger-DP2cCpvL.js.map} +1 -1
  49. package/dist/esm/chunks/memory-http-transport-COJU6VOL.js +2 -0
  50. package/dist/esm/chunks/memory-http-transport-COJU6VOL.js.map +1 -0
  51. package/dist/esm/chunks/node-http-transport-DYCFIJbc.js +2 -0
  52. package/dist/esm/chunks/node-http-transport-DYCFIJbc.js.map +1 -0
  53. package/dist/esm/chunks/{progress-DJU_f66N.js → progress-NePjO3Kd.js} +2 -2
  54. package/dist/esm/chunks/{progress-DJU_f66N.js.map → progress-NePjO3Kd.js.map} +1 -1
  55. package/dist/esm/chunks/repository-Cs-dbHqO.js +2 -0
  56. package/dist/esm/chunks/repository-Cs-dbHqO.js.map +1 -0
  57. package/dist/esm/commands/index.js +1 -1
  58. package/dist/esm/index.browser.js +1 -1
  59. package/dist/esm/index.default.js +1 -1
  60. package/dist/esm/index.js +1 -1
  61. package/dist/esm/index.node.js +1 -1
  62. package/dist/esm/index.node.js.map +1 -1
  63. package/dist/esm/primitives/index.js +1 -1
  64. package/dist/types/adapters/browser/index.d.cts +2 -1
  65. package/dist/types/adapters/browser/index.d.ts +2 -1
  66. package/dist/types/adapters/memory/index.d.cts +21 -2
  67. package/dist/types/adapters/memory/index.d.ts +21 -2
  68. package/dist/types/adapters/node/index.d.cts +64 -3
  69. package/dist/types/adapters/node/index.d.ts +64 -3
  70. package/dist/types/chunks/{context-o5TPfMB2.d.ts → context-BORy7yXb.d.ts} +97 -2
  71. package/dist/types/chunks/{context-D84z1i5F.d.cts → context-CMrHCVwK.d.cts} +97 -2
  72. package/dist/types/chunks/reflog-entry-C2Hsdobk.d.ts +354 -0
  73. package/dist/types/chunks/reflog-entry-DNvSz7S5.d.cts +354 -0
  74. package/dist/types/chunks/{repository-23evW2h-.d.cts → repository-DCR_3RVt.d.cts} +21 -3
  75. package/dist/types/chunks/{repository-BT7Xq1kJ.d.ts → repository-DFxFeYi3.d.ts} +21 -3
  76. package/dist/types/chunks/write-tree-CuhpWKFo.d.cts +164 -0
  77. package/dist/types/chunks/write-tree-Dn1LtIh7.d.ts +164 -0
  78. package/dist/types/commands/index.d.cts +152 -6
  79. package/dist/types/commands/index.d.ts +152 -6
  80. package/dist/types/index.browser.d.cts +4 -4
  81. package/dist/types/index.browser.d.ts +4 -4
  82. package/dist/types/index.d.cts +4 -4
  83. package/dist/types/index.d.ts +4 -4
  84. package/dist/types/index.default.d.cts +4 -4
  85. package/dist/types/index.default.d.ts +4 -4
  86. package/dist/types/index.node.d.cts +4 -4
  87. package/dist/types/index.node.d.ts +4 -4
  88. package/dist/types/primitives/index.d.cts +197 -7
  89. package/dist/types/primitives/index.d.ts +197 -7
  90. package/package.json +207 -17
  91. package/dist/cjs/chunks/browser-http-transport-DcG05jw3.cjs +0 -2
  92. package/dist/cjs/chunks/browser-http-transport-DcG05jw3.cjs.map +0 -1
  93. package/dist/cjs/chunks/error-CqLvhejR.cjs.map +0 -1
  94. package/dist/cjs/chunks/index-BcxdLkNe.cjs +0 -2
  95. package/dist/cjs/chunks/index-BcxdLkNe.cjs.map +0 -1
  96. package/dist/cjs/chunks/index-D5Nd-Mks.cjs +0 -2
  97. package/dist/cjs/chunks/index-D5Nd-Mks.cjs.map +0 -1
  98. package/dist/cjs/chunks/memory-http-transport-Pjyme5KN.cjs.map +0 -1
  99. package/dist/cjs/chunks/node-http-transport-UkW5eEm3.cjs +0 -2
  100. package/dist/cjs/chunks/node-http-transport-UkW5eEm3.cjs.map +0 -1
  101. package/dist/cjs/chunks/repository-B_jx2AKW.cjs +0 -2
  102. package/dist/cjs/chunks/repository-B_jx2AKW.cjs.map +0 -1
  103. package/dist/esm/chunks/browser-http-transport-COFgnEyq.js +0 -2
  104. package/dist/esm/chunks/browser-http-transport-COFgnEyq.js.map +0 -1
  105. package/dist/esm/chunks/error-BN9rdQ33.js.map +0 -1
  106. package/dist/esm/chunks/index-BdV37p4e.js +0 -2
  107. package/dist/esm/chunks/index-BdV37p4e.js.map +0 -1
  108. package/dist/esm/chunks/index-BkRJ9-Im.js +0 -2
  109. package/dist/esm/chunks/index-BkRJ9-Im.js.map +0 -1
  110. package/dist/esm/chunks/memory-http-transport-DRYdYgiE.js +0 -2
  111. package/dist/esm/chunks/memory-http-transport-DRYdYgiE.js.map +0 -1
  112. package/dist/esm/chunks/node-http-transport-Bp5cFZCt.js +0 -2
  113. package/dist/esm/chunks/node-http-transport-Bp5cFZCt.js.map +0 -1
  114. package/dist/esm/chunks/repository-DiagDiT_.js +0 -2
  115. package/dist/esm/chunks/repository-DiagDiT_.js.map +0 -1
  116. package/dist/types/chunks/diff-change-Bm1zvVsC.d.cts +0 -59
  117. package/dist/types/chunks/diff-change-alGRzD_j.d.ts +0 -59
  118. package/dist/types/chunks/write-tree-DNjhjS3t.d.ts +0 -282
  119. package/dist/types/chunks/write-tree-DVp0RJ_r.d.cts +0 -282
@@ -1,9 +1,9 @@
1
- import { f as FileSystem, H as HashService, C as Compressor, P as ProgressReporter } from './chunks/context-o5TPfMB2.js';
2
- export { A as AuthStrategy, a as AuthorIdentity, b as Context, c as CreateContextParts, D as DirEntry, e as FileStat, g as Hasher, L as Logger, h as RepositoryConfig, i as RepositoryLayout, j as createContext, n as noopLogger, w as wrapLoggerSanitizer } from './chunks/context-o5TPfMB2.js';
1
+ import { f as FileSystem, H as HashService, C as Compressor, P as ProgressReporter } from './chunks/context-BORy7yXb.js';
2
+ export { A as AuthStrategy, a as AuthorIdentity, b as Context, c as CreateContextParts, D as DirEntry, e as FileStat, g as Hasher, h as HookName, i as HookRequest, j as HookResult, k as HookRunner, L as Logger, l as PromisorFetchOutcome, m as PromisorRemote, n as RepositoryConfig, o as RepositoryLayout, p as createContext, q as noopLogger, w as wrapLoggerSanitizer } from './chunks/context-BORy7yXb.js';
3
3
  import { b as HttpTransport } from './chunks/http-transport-DirKfK2S.js';
4
4
  export { H as HttpRequest, a as HttpResponse } from './chunks/http-transport-DirKfK2S.js';
5
- export { AddOptions, AddResult, BranchAction, BranchInfo, BranchResult, ChangeEntry, ChangeKind, CheckoutOptions, CheckoutResult, CloneOptions, CloneResult, CommitOptions, CommitResult, DiffOptions, FetchOptions, FetchResult, InitOptions, InitResult, LogEntry, LogOptions, MergeOptions, MergeResult, PushOptions, PushResult, ResetMode, ResetOptions, ResetResult, RmOptions, RmResult, StatusResult, TagAction, TagInfo, TagResult, add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from './commands/index.js';
6
- import './chunks/diff-change-alGRzD_j.js';
5
+ export { AddOptions, AddResult, BranchAction, BranchInfo, BranchResult, CatFileInput, CatFileResult, ChangeEntry, ChangeKind, CheckoutOptions, CheckoutResult, CloneOptions, CloneResult, CommitOptions, CommitResult, DiffOptions, FetchMissingOptions, FetchMissingResult, FetchOptions, FetchResult, InitOptions, InitResult, LogEntry, LogOptions, MergeOptions, MergeResult, PushOptions, PushResult, ReflogAction, ReflogResult, ReflogShowEntry, ResetMode, ResetOptions, ResetResult, RmOptions, RmResult, SparseCheckoutAction, SparseCheckoutResult, StatusResult, SubmodulesAction, SubmodulesResult, TagAction, TagInfo, TagResult, add, branch, catFile, checkout, clone, commit, createPromisorRemote, diff, fetch, fetchMissing, init, log, merge, push, reflog, reset, revParse, rm, sparseCheckout, status, submodules, tag } from './commands/index.js';
6
+ export { C as CatFileBatchEntry, S as SubmoduleEntry } from './chunks/reflog-entry-C2Hsdobk.js';
7
7
 
8
8
  /**
9
9
  * The four adapter ports the facade plumbs into the Context. Each runtime
@@ -1,9 +1,9 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-23evW2h-.cjs';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DCR_3RVt.cjs';
2
2
  export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.cjs';
3
- export { P as ProgressReporter } from './chunks/context-D84z1i5F.cjs';
3
+ export { P as ProgressReporter } from './chunks/context-CMrHCVwK.cjs';
4
4
  import './commands/index.cjs';
5
- import './chunks/diff-change-Bm1zvVsC.cjs';
6
- import './chunks/write-tree-DVp0RJ_r.cjs';
5
+ import './chunks/reflog-entry-DNvSz7S5.cjs';
6
+ import './chunks/write-tree-CuhpWKFo.cjs';
7
7
  import './chunks/http-transport-DirKfK2S.cjs';
8
8
 
9
9
  /**
@@ -1,9 +1,9 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-BT7Xq1kJ.js';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DFxFeYi3.js';
2
2
  export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.js';
3
- export { P as ProgressReporter } from './chunks/context-o5TPfMB2.js';
3
+ export { P as ProgressReporter } from './chunks/context-BORy7yXb.js';
4
4
  import './commands/index.js';
5
- import './chunks/diff-change-alGRzD_j.js';
6
- import './chunks/write-tree-DNjhjS3t.js';
5
+ import './chunks/reflog-entry-C2Hsdobk.js';
6
+ import './chunks/write-tree-Dn1LtIh7.js';
7
7
  import './chunks/http-transport-DirKfK2S.js';
8
8
 
9
9
  /**
@@ -1,9 +1,9 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-23evW2h-.cjs';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DCR_3RVt.cjs';
2
2
  export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.cjs';
3
- export { P as ProgressReporter } from './chunks/context-D84z1i5F.cjs';
3
+ export { P as ProgressReporter } from './chunks/context-CMrHCVwK.cjs';
4
4
  import './commands/index.cjs';
5
- import './chunks/diff-change-Bm1zvVsC.cjs';
6
- import './chunks/write-tree-DVp0RJ_r.cjs';
5
+ import './chunks/reflog-entry-DNvSz7S5.cjs';
6
+ import './chunks/write-tree-CuhpWKFo.cjs';
7
7
  import './chunks/http-transport-DirKfK2S.cjs';
8
8
 
9
9
  /**
@@ -1,9 +1,9 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-BT7Xq1kJ.js';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DFxFeYi3.js';
2
2
  export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.js';
3
- export { P as ProgressReporter } from './chunks/context-o5TPfMB2.js';
3
+ export { P as ProgressReporter } from './chunks/context-BORy7yXb.js';
4
4
  import './commands/index.js';
5
- import './chunks/diff-change-alGRzD_j.js';
6
- import './chunks/write-tree-DNjhjS3t.js';
5
+ import './chunks/reflog-entry-C2Hsdobk.js';
6
+ import './chunks/write-tree-Dn1LtIh7.js';
7
7
  import './chunks/http-transport-DirKfK2S.js';
8
8
 
9
9
  /**
@@ -1,10 +1,13 @@
1
- import { G as GitIndex, I as IndexEntry } from '../chunks/write-tree-DVp0RJ_r.cjs';
2
- export { C as CreateCommitInput, D as DiffTreesInput, a as DiffTreesOptions, M as MAX_COMMIT_MESSAGE_BYTES, b as MAX_GITIGNORE_BYTES, c as MAX_HAVES, d as MAX_INDEX_BYTES, e as MAX_PEEL_DEPTH, f as MAX_PUSH_OBJECTS, g as MAX_SYMBOLIC_REF_DEPTH, h as MAX_WALK_QUEUE_SIZE, i as MAX_WALK_SEEDS, j as MAX_WORKING_TREE_BLOB_BYTES, R as ReadObjectOptions, k as ResolveRefOptions, U as UpdateRefOptions, W as WalkCommitsOptions, l as WalkIgnorePredicate, m as WalkTreeEntry, n as WalkTreeOptions, o as WalkWorkingTreeEntry, p as WalkWorkingTreeOptions, q as createCommit, r as diffTrees, s as getRepoRoot, t as mergeBase, u as readBlob, v as readIndex, w as readObject, x as readTree, y as resolveRef, z as updateRef, A as walkCommits, B as walkTree, E as walkWorkingTree, F as writeObject, H as writeSymbolicRef, J as writeTree } from '../chunks/write-tree-DVp0RJ_r.cjs';
3
- import { d as FilePath, O as ObjectId, b as Context } from '../chunks/context-D84z1i5F.cjs';
4
- import { F as FileMode } from '../chunks/diff-change-Bm1zvVsC.cjs';
5
- export { T as TreeDiff } from '../chunks/diff-change-Bm1zvVsC.cjs';
1
+ import { G as GitIndex, I as IndexEntry } from '../chunks/write-tree-CuhpWKFo.cjs';
2
+ export { H as HookInput, c as catFileBatch, a as createCommit, d as diffTrees, g as getRepoRoot, m as mergeBase, r as readBlob, b as readIndex, e as readObject, f as readTree, h as recordRefUpdate, i as resolveRef, j as runHook, s as sparseCheckoutPath, u as updateRef, w as walkCommits, k as walkSubmodules, l as walkTree, n as walkWorkingTree, o as writeObject, p as writeSymbolicRef, q as writeTree } from '../chunks/write-tree-CuhpWKFo.cjs';
3
+ import { d as FilePath, O as ObjectId, b as Context, R as RefName } from '../chunks/context-CMrHCVwK.cjs';
4
+ import { F as FileMode, A as AuthorIdentity, q as ReflogEntry } from '../chunks/reflog-entry-DNvSz7S5.cjs';
5
+ export { C as CatFileBatchEntry, a as CatFileBatchOptions, c as CreateCommitInput, D as DiffTreesInput, d as DiffTreesOptions, M as MAX_COMMIT_MESSAGE_BYTES, e as MAX_GITIGNORE_BYTES, f as MAX_GITMODULES_BYTES, g as MAX_HAVES, h as MAX_INDEX_BYTES, i as MAX_PEEL_DEPTH, j as MAX_PUSH_OBJECTS, k as MAX_REFLOG_BYTES, l as MAX_SUBMODULE_DEPTH, m as MAX_SYMBOLIC_REF_DEPTH, n as MAX_WALK_QUEUE_SIZE, o as MAX_WALK_SEEDS, p as MAX_WORKING_TREE_BLOB_BYTES, R as ReadObjectOptions, r as ResolveRefOptions, S as SubmoduleEntry, s as TreeDiff, U as UpdateRefOptions, W as WalkCommitsOptions, u as WalkIgnorePredicate, v as WalkSubmodulesOptions, w as WalkTreeEntry, x as WalkTreeOptions, y as WalkWorkingTreeEntry, z as WalkWorkingTreeOptions } from '../chunks/reflog-entry-DNvSz7S5.cjs';
6
6
  import { b as HttpTransport } from '../chunks/http-transport-DirKfK2S.cjs';
7
7
 
8
+ /** `true` ⇒ the path is in the sparse set (materialise it). */
9
+ type SparseMatcher = (path: FilePath) => boolean;
10
+
8
11
  /**
9
12
  * Pure helper that diffs a current GitIndex against a target tree's flat
10
13
  * entry list and emits an ordered ChangesetEntry list. No FS, no ctx; the
@@ -49,6 +52,12 @@ interface ApplyChangesetResult {
49
52
  readonly written: number;
50
53
  readonly deleted: number;
51
54
  }
55
+ /**
56
+ * `true` when a working-tree file exists at `absPath` but its blob content
57
+ * hash differs from `expectedId`. An absent file is not dirty. Shared by
58
+ * `applySparseCheckout`'s narrowing pre-scan (design §9).
59
+ */
60
+ declare const isWorkingTreeDirty: (ctx: Context, absPath: string, expectedId: string) => Promise<boolean>;
52
61
  declare const applyChangeset: (ctx: Context, opts: ApplyChangesetOpts) => Promise<ApplyChangesetResult>;
53
62
 
54
63
  /**
@@ -77,6 +86,13 @@ declare const applyChangeset: (ctx: Context, opts: ApplyChangesetOpts) => Promis
77
86
  interface BuildIndexFromTreeOpts {
78
87
  readonly targetTree: ObjectId;
79
88
  readonly currentIndex: GitIndex;
89
+ /**
90
+ * Sparse-checkout filter. When supplied, an excluded path is rebuilt as a
91
+ * zero-stat skip-worktree entry and an in-pattern path has any stale
92
+ * skip-worktree bit cleared. `undefined` ⇒ sparse inactive — the rebuilt
93
+ * index is byte-identical to the non-sparse behaviour.
94
+ */
95
+ readonly sparse?: SparseMatcher;
80
96
  }
81
97
  declare const buildIndexFromTree: (ctx: Context, opts: BuildIndexFromTreeOpts) => Promise<ReadonlyArray<IndexEntry>>;
82
98
 
@@ -91,6 +107,56 @@ interface BuildPackResult {
91
107
  }
92
108
  declare const buildPack: (ctx: Context, input: BuildPackInput) => Promise<BuildPackResult>;
93
109
 
110
+ /**
111
+ * Subset of `.git/config` that v1 commands consume. Only fields actually used by
112
+ * commands are typed — the parser ignores everything else (lenient, like git itself).
113
+ */
114
+ interface ParsedConfig {
115
+ readonly core?: {
116
+ readonly bare?: boolean;
117
+ readonly excludesFile?: string;
118
+ readonly logAllRefUpdates?: boolean | 'always';
119
+ readonly hooksPath?: string;
120
+ readonly sparseCheckout?: boolean;
121
+ readonly sparseCheckoutCone?: boolean;
122
+ };
123
+ readonly user?: {
124
+ readonly name: string;
125
+ readonly email: string;
126
+ };
127
+ readonly remote?: ReadonlyMap<string, {
128
+ readonly url?: string;
129
+ readonly fetch?: ReadonlyArray<string>;
130
+ /** `remote.<name>.promisor` — true when this is a partial-clone promisor remote. */
131
+ readonly promisor?: boolean;
132
+ /** `remote.<name>.partialclonefilter` — the canonical filter spec applied at clone. */
133
+ readonly partialCloneFilter?: string;
134
+ }>;
135
+ readonly branch?: ReadonlyMap<string, {
136
+ readonly remote?: string;
137
+ readonly merge?: string;
138
+ }>;
139
+ /** `[extensions]` — `partialClone` names the promisor remote of a partial clone. */
140
+ readonly extensions?: {
141
+ readonly partialClone?: string;
142
+ };
143
+ }
144
+ /**
145
+ * Read and cache `${gitDir}/config`. Missing → empty config (not an error).
146
+ *
147
+ * The cache is keyed on `Context` identity; a new context (e.g., after a write
148
+ * that re-creates the repo) gets a fresh read. Concurrent calls share the same
149
+ * in-flight promise (per-context single-flight).
150
+ */
151
+ declare const readConfig: (ctx: Context) => Promise<ParsedConfig>;
152
+ /**
153
+ * Drop the cached `readConfig` entry for a single `Context`. The production
154
+ * invalidator: a config write (`updateCoreConfig`) calls this so a subsequent
155
+ * `readConfig` on the same context re-reads the file instead of serving the
156
+ * stale parse.
157
+ */
158
+ declare const invalidateConfigCache: (ctx: Context) => void;
159
+
94
160
  interface EnumeratePushObjectsInput {
95
161
  /**
96
162
  * Object ids the caller wants on the remote. Each MUST resolve to a
@@ -105,6 +171,14 @@ interface EnumeratePushObjectsInput {
105
171
  }
106
172
  declare function enumeratePushObjects(ctx: Context, input: EnumeratePushObjectsInput): AsyncIterable<ObjectId>;
107
173
 
174
+ /**
175
+ * Enumerate every current ref: `HEAD`, loose refs under `.git/refs/**`, and
176
+ * packed-refs entries — deduplicated. Used by `reflog expire` to seed the
177
+ * reachable-commit walk; not on any hot path.
178
+ */
179
+
180
+ declare function enumerateRefs(ctx: Context): Promise<ReadonlyArray<RefName>>;
181
+
108
182
  interface FetchPackInput {
109
183
  /** Advertised refs the caller wants. MUST be non-empty (server-side requirement). */
110
184
  readonly wants: ReadonlyArray<ObjectId>;
@@ -122,6 +196,17 @@ interface FetchPackInput {
122
196
  *
123
197
  */
124
198
  readonly depth?: number;
199
+ /**
200
+ * Partial-clone object filter — a canonical filter spec. When set, a
201
+ * `filter` line is emitted; the caller must have negotiated the `filter`
202
+ * capability.
203
+ */
204
+ readonly filter?: string;
205
+ /**
206
+ * When true, write an empty `pack-<sha>.promisor` sentinel beside the pack
207
+ * so the objects it references but omits are treated as promised.
208
+ */
209
+ readonly promisor?: boolean;
125
210
  }
126
211
  interface FetchPackResult {
127
212
  readonly packPath: string;
@@ -180,6 +265,17 @@ interface MaterializeTreeOpts {
180
265
  * 13.1 checkout behaviour: clean files are never spuriously rewritten.
181
266
  */
182
267
  readonly forceRewriteAll?: boolean;
268
+ /**
269
+ * Branch-switch sparse-checkout filter. Honoured ONLY when `paths` is
270
+ * undefined. A target-tree path the matcher rejects is NOT written to the
271
+ * working tree; its `newIndexEntries` record carries `skipWorktree: true`
272
+ * (the index keeps every path — git-faithful). A path the matcher accepts
273
+ * that the *current* index records as skip-worktree (absent on disk) is
274
+ * materialised even when its `id` matches, because the current index is
275
+ * filtered to drop skip-worktree entries before the diff — such a path
276
+ * classifies as `add`, never `noop`.
277
+ */
278
+ readonly sparse?: SparseMatcher;
183
279
  }
184
280
  interface MaterializeTreeResult {
185
281
  readonly newIndexEntries: ReadonlyArray<IndexEntry>;
@@ -188,6 +284,53 @@ interface MaterializeTreeResult {
188
284
  }
189
285
  declare const materializeTree: (ctx: Context, opts: MaterializeTreeOpts) => Promise<MaterializeTreeResult>;
190
286
 
287
+ /**
288
+ * Hard cap on the `.git/info/sparse-checkout` file — 1 MiB, mirroring
289
+ * `MAX_GITIGNORE_BYTES`. A plain literal (not `1024 * 1024`) so a boundary test
290
+ * keyed on the constant cannot drift with an arithmetic mutation of it.
291
+ */
292
+ declare const MAX_SPARSE_PATTERN_FILE_BYTES = 1048576;
293
+ /**
294
+ * Read `.git/info/sparse-checkout` as UTF-8 text. An absent file yields
295
+ * `undefined`; a file whose byte length exceeds
296
+ * `MAX_SPARSE_PATTERN_FILE_BYTES` throws `SPARSE_PATTERN_FILE_TOO_LARGE`
297
+ * (checked before decode so an over-cap file never reaches the decoder).
298
+ */
299
+ declare const readSparsePatternText: (ctx: Context) => Promise<string | undefined>;
300
+ /**
301
+ * Build the sparse matcher for the current repository. Returns `undefined`
302
+ * when `core.sparseCheckout` is falsy/absent — sparse is inactive and callers
303
+ * behave exactly as a non-sparse repo. When active, the matcher is parsed in
304
+ * the mode `core.sparseCheckoutCone` dictates; a cone file that degrades to
305
+ * non-cone matching logs one warning.
306
+ */
307
+ declare const loadSparseMatcher: (ctx: Context) => Promise<SparseMatcher | undefined>;
308
+
309
+ /**
310
+ * Committer identity for reflog entries: config `user.*` plus a fresh
311
+ * timestamp, or a portable fallback when `user.*` is unset. Never throws —
312
+ * reflog logging must not abort a ref update.
313
+ */
314
+ declare function resolveReflogIdentity(ctx: Context): Promise<AuthorIdentity>;
315
+
316
+ /**
317
+ * Thin I/O layer over `.git/logs/<ref>` reflog files. Append is the hot path;
318
+ * whole-file rewrite and delete back the `reflog` command's expire / delete.
319
+ */
320
+
321
+ /** Append one entry to `ref`'s reflog, creating the file and parents as needed. */
322
+ declare function appendReflog(ctx: Context, ref: RefName, entry: ReflogEntry): Promise<void>;
323
+ /** Read `ref`'s reflog, oldest-first. Returns `[]` when the file is absent. */
324
+ declare function readReflog(ctx: Context, ref: RefName): Promise<ReadonlyArray<ReflogEntry>>;
325
+ /** Whether `ref` has a reflog file at all. */
326
+ declare function reflogExists(ctx: Context, ref: RefName): Promise<boolean>;
327
+ /** Replace `ref`'s reflog with exactly `entries`. Used by expire / delete. */
328
+ declare function writeReflog(ctx: Context, ref: RefName, entries: ReadonlyArray<ReflogEntry>): Promise<void>;
329
+ /** Remove `ref`'s reflog file. A no-op when the file is already absent. */
330
+ declare function deleteReflog(ctx: Context, ref: RefName): Promise<void>;
331
+ /** Every reflog under `.git/logs/`, each as the `RefName` it logs. */
332
+ declare function listReflogs(ctx: Context): Promise<ReadonlyArray<RefName>>;
333
+
191
334
  /**
192
335
  * Read `.git/shallow`. Returns an empty set when the file does not exist or
193
336
  * contains no oids. Malformed lines are tolerated (skipped) — canonical
@@ -250,5 +393,52 @@ declare const updateShallow: (ctx: Context, updates: ShallowUpdate) => Promise<v
250
393
  */
251
394
  declare const synthesizeTreeFromIndex: (ctx: Context, entries: ReadonlyArray<IndexEntry>) => Promise<ObjectId>;
252
395
 
253
- export { applyChangeset, buildIndexFromTree, buildPack, computeChangeset, enumeratePushObjects, fetchPack, materializeTree, readShallow, synthesizeTreeFromIndex, updateShallow };
254
- export type { ApplyChangesetOpts, ApplyChangesetResult, BuildIndexFromTreeOpts, BuildPackInput, BuildPackResult, Changeset, ChangesetEntry, ChangesetStats, EnumeratePushObjectsInput, FetchPackInput, FetchPackResult, MaterializeTreeOpts, MaterializeTreeResult };
396
+ /**
397
+ * Set `key` under `[section]` / `[section "subsection"]`, preserving every
398
+ * other byte verbatim.
399
+ *
400
+ * - existing section with that key ⇒ its value is replaced;
401
+ * - existing section without that key ⇒ a `\t<key> = <value>` line is
402
+ * inserted right after the header;
403
+ * - no such section ⇒ `[section]\n\t<key> = <value>\n` is appended.
404
+ */
405
+ declare const setConfigEntry: (text: string, section: string, subsection: string | undefined, key: string, value: string) => string;
406
+ /** `setConfigEntry` bound to the `[core]` section — kept for legacy callers. */
407
+ declare const setCoreConfigEntry: (text: string, key: string, value: string) => string;
408
+ /** One `key = value` write under `[section]` / `[section "subsection"]`. */
409
+ interface ConfigEntry {
410
+ readonly section: string;
411
+ readonly subsection?: string;
412
+ readonly key: string;
413
+ readonly value: string;
414
+ }
415
+ /**
416
+ * Read `${gitDir}/config` (a missing file is treated as `''`), fold
417
+ * `setConfigEntry` over `entries`, write the result, and invalidate the
418
+ * per-`Context` `readConfig` cache so a later read sees the new values.
419
+ */
420
+ declare const updateConfigEntries: (ctx: Context, entries: ReadonlyArray<ConfigEntry>) => Promise<void>;
421
+ /** Fold a batch of `[core]` `key = value` writes via `updateConfigEntries`. */
422
+ declare const updateCoreConfig: (ctx: Context, entries: Record<string, string>) => Promise<void>;
423
+
424
+ /**
425
+ * Write the `.git/info/sparse-checkout` pattern file. The command tier
426
+ * computes the text (via `serializeCone` or raw non-cone lines); this
427
+ * primitive only persists it (design §7.3).
428
+ *
429
+ * @writes
430
+ * surface: sparseCheckoutFile
431
+ * kind: byte-identical
432
+ * format: git-sparse-checkout
433
+ */
434
+
435
+ /**
436
+ * Persist `text` to `.git/info/sparse-checkout`. The `.git/info` directory is
437
+ * created defensively first — `writeUtf8` creates parents on every adapter,
438
+ * but an explicit `mkdir` keeps the contract clear and survives adapters that
439
+ * tighten that guarantee.
440
+ */
441
+ declare const writeSparsePatternText: (ctx: Context, text: string) => Promise<void>;
442
+
443
+ export { MAX_SPARSE_PATTERN_FILE_BYTES, appendReflog, applyChangeset, buildIndexFromTree, buildPack, computeChangeset, deleteReflog, enumeratePushObjects, enumerateRefs, fetchPack, invalidateConfigCache, isWorkingTreeDirty, listReflogs, loadSparseMatcher, materializeTree, readConfig, readReflog, readShallow, readSparsePatternText, reflogExists, resolveReflogIdentity, setConfigEntry, setCoreConfigEntry, synthesizeTreeFromIndex, updateConfigEntries, updateCoreConfig, updateShallow, writeReflog, writeSparsePatternText };
444
+ export type { ApplyChangesetOpts, ApplyChangesetResult, BuildIndexFromTreeOpts, BuildPackInput, BuildPackResult, Changeset, ChangesetEntry, ChangesetStats, ConfigEntry, EnumeratePushObjectsInput, FetchPackInput, FetchPackResult, MaterializeTreeOpts, MaterializeTreeResult, ParsedConfig };
@@ -1,10 +1,13 @@
1
- import { G as GitIndex, I as IndexEntry } from '../chunks/write-tree-DNjhjS3t.js';
2
- export { C as CreateCommitInput, D as DiffTreesInput, a as DiffTreesOptions, M as MAX_COMMIT_MESSAGE_BYTES, b as MAX_GITIGNORE_BYTES, c as MAX_HAVES, d as MAX_INDEX_BYTES, e as MAX_PEEL_DEPTH, f as MAX_PUSH_OBJECTS, g as MAX_SYMBOLIC_REF_DEPTH, h as MAX_WALK_QUEUE_SIZE, i as MAX_WALK_SEEDS, j as MAX_WORKING_TREE_BLOB_BYTES, R as ReadObjectOptions, k as ResolveRefOptions, U as UpdateRefOptions, W as WalkCommitsOptions, l as WalkIgnorePredicate, m as WalkTreeEntry, n as WalkTreeOptions, o as WalkWorkingTreeEntry, p as WalkWorkingTreeOptions, q as createCommit, r as diffTrees, s as getRepoRoot, t as mergeBase, u as readBlob, v as readIndex, w as readObject, x as readTree, y as resolveRef, z as updateRef, A as walkCommits, B as walkTree, E as walkWorkingTree, F as writeObject, H as writeSymbolicRef, J as writeTree } from '../chunks/write-tree-DNjhjS3t.js';
3
- import { d as FilePath, O as ObjectId, b as Context } from '../chunks/context-o5TPfMB2.js';
4
- import { F as FileMode } from '../chunks/diff-change-alGRzD_j.js';
5
- export { T as TreeDiff } from '../chunks/diff-change-alGRzD_j.js';
1
+ import { G as GitIndex, I as IndexEntry } from '../chunks/write-tree-Dn1LtIh7.js';
2
+ export { H as HookInput, c as catFileBatch, a as createCommit, d as diffTrees, g as getRepoRoot, m as mergeBase, r as readBlob, b as readIndex, e as readObject, f as readTree, h as recordRefUpdate, i as resolveRef, j as runHook, s as sparseCheckoutPath, u as updateRef, w as walkCommits, k as walkSubmodules, l as walkTree, n as walkWorkingTree, o as writeObject, p as writeSymbolicRef, q as writeTree } from '../chunks/write-tree-Dn1LtIh7.js';
3
+ import { d as FilePath, O as ObjectId, b as Context, R as RefName } from '../chunks/context-BORy7yXb.js';
4
+ import { F as FileMode, A as AuthorIdentity, q as ReflogEntry } from '../chunks/reflog-entry-C2Hsdobk.js';
5
+ export { C as CatFileBatchEntry, a as CatFileBatchOptions, c as CreateCommitInput, D as DiffTreesInput, d as DiffTreesOptions, M as MAX_COMMIT_MESSAGE_BYTES, e as MAX_GITIGNORE_BYTES, f as MAX_GITMODULES_BYTES, g as MAX_HAVES, h as MAX_INDEX_BYTES, i as MAX_PEEL_DEPTH, j as MAX_PUSH_OBJECTS, k as MAX_REFLOG_BYTES, l as MAX_SUBMODULE_DEPTH, m as MAX_SYMBOLIC_REF_DEPTH, n as MAX_WALK_QUEUE_SIZE, o as MAX_WALK_SEEDS, p as MAX_WORKING_TREE_BLOB_BYTES, R as ReadObjectOptions, r as ResolveRefOptions, S as SubmoduleEntry, s as TreeDiff, U as UpdateRefOptions, W as WalkCommitsOptions, u as WalkIgnorePredicate, v as WalkSubmodulesOptions, w as WalkTreeEntry, x as WalkTreeOptions, y as WalkWorkingTreeEntry, z as WalkWorkingTreeOptions } from '../chunks/reflog-entry-C2Hsdobk.js';
6
6
  import { b as HttpTransport } from '../chunks/http-transport-DirKfK2S.js';
7
7
 
8
+ /** `true` ⇒ the path is in the sparse set (materialise it). */
9
+ type SparseMatcher = (path: FilePath) => boolean;
10
+
8
11
  /**
9
12
  * Pure helper that diffs a current GitIndex against a target tree's flat
10
13
  * entry list and emits an ordered ChangesetEntry list. No FS, no ctx; the
@@ -49,6 +52,12 @@ interface ApplyChangesetResult {
49
52
  readonly written: number;
50
53
  readonly deleted: number;
51
54
  }
55
+ /**
56
+ * `true` when a working-tree file exists at `absPath` but its blob content
57
+ * hash differs from `expectedId`. An absent file is not dirty. Shared by
58
+ * `applySparseCheckout`'s narrowing pre-scan (design §9).
59
+ */
60
+ declare const isWorkingTreeDirty: (ctx: Context, absPath: string, expectedId: string) => Promise<boolean>;
52
61
  declare const applyChangeset: (ctx: Context, opts: ApplyChangesetOpts) => Promise<ApplyChangesetResult>;
53
62
 
54
63
  /**
@@ -77,6 +86,13 @@ declare const applyChangeset: (ctx: Context, opts: ApplyChangesetOpts) => Promis
77
86
  interface BuildIndexFromTreeOpts {
78
87
  readonly targetTree: ObjectId;
79
88
  readonly currentIndex: GitIndex;
89
+ /**
90
+ * Sparse-checkout filter. When supplied, an excluded path is rebuilt as a
91
+ * zero-stat skip-worktree entry and an in-pattern path has any stale
92
+ * skip-worktree bit cleared. `undefined` ⇒ sparse inactive — the rebuilt
93
+ * index is byte-identical to the non-sparse behaviour.
94
+ */
95
+ readonly sparse?: SparseMatcher;
80
96
  }
81
97
  declare const buildIndexFromTree: (ctx: Context, opts: BuildIndexFromTreeOpts) => Promise<ReadonlyArray<IndexEntry>>;
82
98
 
@@ -91,6 +107,56 @@ interface BuildPackResult {
91
107
  }
92
108
  declare const buildPack: (ctx: Context, input: BuildPackInput) => Promise<BuildPackResult>;
93
109
 
110
+ /**
111
+ * Subset of `.git/config` that v1 commands consume. Only fields actually used by
112
+ * commands are typed — the parser ignores everything else (lenient, like git itself).
113
+ */
114
+ interface ParsedConfig {
115
+ readonly core?: {
116
+ readonly bare?: boolean;
117
+ readonly excludesFile?: string;
118
+ readonly logAllRefUpdates?: boolean | 'always';
119
+ readonly hooksPath?: string;
120
+ readonly sparseCheckout?: boolean;
121
+ readonly sparseCheckoutCone?: boolean;
122
+ };
123
+ readonly user?: {
124
+ readonly name: string;
125
+ readonly email: string;
126
+ };
127
+ readonly remote?: ReadonlyMap<string, {
128
+ readonly url?: string;
129
+ readonly fetch?: ReadonlyArray<string>;
130
+ /** `remote.<name>.promisor` — true when this is a partial-clone promisor remote. */
131
+ readonly promisor?: boolean;
132
+ /** `remote.<name>.partialclonefilter` — the canonical filter spec applied at clone. */
133
+ readonly partialCloneFilter?: string;
134
+ }>;
135
+ readonly branch?: ReadonlyMap<string, {
136
+ readonly remote?: string;
137
+ readonly merge?: string;
138
+ }>;
139
+ /** `[extensions]` — `partialClone` names the promisor remote of a partial clone. */
140
+ readonly extensions?: {
141
+ readonly partialClone?: string;
142
+ };
143
+ }
144
+ /**
145
+ * Read and cache `${gitDir}/config`. Missing → empty config (not an error).
146
+ *
147
+ * The cache is keyed on `Context` identity; a new context (e.g., after a write
148
+ * that re-creates the repo) gets a fresh read. Concurrent calls share the same
149
+ * in-flight promise (per-context single-flight).
150
+ */
151
+ declare const readConfig: (ctx: Context) => Promise<ParsedConfig>;
152
+ /**
153
+ * Drop the cached `readConfig` entry for a single `Context`. The production
154
+ * invalidator: a config write (`updateCoreConfig`) calls this so a subsequent
155
+ * `readConfig` on the same context re-reads the file instead of serving the
156
+ * stale parse.
157
+ */
158
+ declare const invalidateConfigCache: (ctx: Context) => void;
159
+
94
160
  interface EnumeratePushObjectsInput {
95
161
  /**
96
162
  * Object ids the caller wants on the remote. Each MUST resolve to a
@@ -105,6 +171,14 @@ interface EnumeratePushObjectsInput {
105
171
  }
106
172
  declare function enumeratePushObjects(ctx: Context, input: EnumeratePushObjectsInput): AsyncIterable<ObjectId>;
107
173
 
174
+ /**
175
+ * Enumerate every current ref: `HEAD`, loose refs under `.git/refs/**`, and
176
+ * packed-refs entries — deduplicated. Used by `reflog expire` to seed the
177
+ * reachable-commit walk; not on any hot path.
178
+ */
179
+
180
+ declare function enumerateRefs(ctx: Context): Promise<ReadonlyArray<RefName>>;
181
+
108
182
  interface FetchPackInput {
109
183
  /** Advertised refs the caller wants. MUST be non-empty (server-side requirement). */
110
184
  readonly wants: ReadonlyArray<ObjectId>;
@@ -122,6 +196,17 @@ interface FetchPackInput {
122
196
  *
123
197
  */
124
198
  readonly depth?: number;
199
+ /**
200
+ * Partial-clone object filter — a canonical filter spec. When set, a
201
+ * `filter` line is emitted; the caller must have negotiated the `filter`
202
+ * capability.
203
+ */
204
+ readonly filter?: string;
205
+ /**
206
+ * When true, write an empty `pack-<sha>.promisor` sentinel beside the pack
207
+ * so the objects it references but omits are treated as promised.
208
+ */
209
+ readonly promisor?: boolean;
125
210
  }
126
211
  interface FetchPackResult {
127
212
  readonly packPath: string;
@@ -180,6 +265,17 @@ interface MaterializeTreeOpts {
180
265
  * 13.1 checkout behaviour: clean files are never spuriously rewritten.
181
266
  */
182
267
  readonly forceRewriteAll?: boolean;
268
+ /**
269
+ * Branch-switch sparse-checkout filter. Honoured ONLY when `paths` is
270
+ * undefined. A target-tree path the matcher rejects is NOT written to the
271
+ * working tree; its `newIndexEntries` record carries `skipWorktree: true`
272
+ * (the index keeps every path — git-faithful). A path the matcher accepts
273
+ * that the *current* index records as skip-worktree (absent on disk) is
274
+ * materialised even when its `id` matches, because the current index is
275
+ * filtered to drop skip-worktree entries before the diff — such a path
276
+ * classifies as `add`, never `noop`.
277
+ */
278
+ readonly sparse?: SparseMatcher;
183
279
  }
184
280
  interface MaterializeTreeResult {
185
281
  readonly newIndexEntries: ReadonlyArray<IndexEntry>;
@@ -188,6 +284,53 @@ interface MaterializeTreeResult {
188
284
  }
189
285
  declare const materializeTree: (ctx: Context, opts: MaterializeTreeOpts) => Promise<MaterializeTreeResult>;
190
286
 
287
+ /**
288
+ * Hard cap on the `.git/info/sparse-checkout` file — 1 MiB, mirroring
289
+ * `MAX_GITIGNORE_BYTES`. A plain literal (not `1024 * 1024`) so a boundary test
290
+ * keyed on the constant cannot drift with an arithmetic mutation of it.
291
+ */
292
+ declare const MAX_SPARSE_PATTERN_FILE_BYTES = 1048576;
293
+ /**
294
+ * Read `.git/info/sparse-checkout` as UTF-8 text. An absent file yields
295
+ * `undefined`; a file whose byte length exceeds
296
+ * `MAX_SPARSE_PATTERN_FILE_BYTES` throws `SPARSE_PATTERN_FILE_TOO_LARGE`
297
+ * (checked before decode so an over-cap file never reaches the decoder).
298
+ */
299
+ declare const readSparsePatternText: (ctx: Context) => Promise<string | undefined>;
300
+ /**
301
+ * Build the sparse matcher for the current repository. Returns `undefined`
302
+ * when `core.sparseCheckout` is falsy/absent — sparse is inactive and callers
303
+ * behave exactly as a non-sparse repo. When active, the matcher is parsed in
304
+ * the mode `core.sparseCheckoutCone` dictates; a cone file that degrades to
305
+ * non-cone matching logs one warning.
306
+ */
307
+ declare const loadSparseMatcher: (ctx: Context) => Promise<SparseMatcher | undefined>;
308
+
309
+ /**
310
+ * Committer identity for reflog entries: config `user.*` plus a fresh
311
+ * timestamp, or a portable fallback when `user.*` is unset. Never throws —
312
+ * reflog logging must not abort a ref update.
313
+ */
314
+ declare function resolveReflogIdentity(ctx: Context): Promise<AuthorIdentity>;
315
+
316
+ /**
317
+ * Thin I/O layer over `.git/logs/<ref>` reflog files. Append is the hot path;
318
+ * whole-file rewrite and delete back the `reflog` command's expire / delete.
319
+ */
320
+
321
+ /** Append one entry to `ref`'s reflog, creating the file and parents as needed. */
322
+ declare function appendReflog(ctx: Context, ref: RefName, entry: ReflogEntry): Promise<void>;
323
+ /** Read `ref`'s reflog, oldest-first. Returns `[]` when the file is absent. */
324
+ declare function readReflog(ctx: Context, ref: RefName): Promise<ReadonlyArray<ReflogEntry>>;
325
+ /** Whether `ref` has a reflog file at all. */
326
+ declare function reflogExists(ctx: Context, ref: RefName): Promise<boolean>;
327
+ /** Replace `ref`'s reflog with exactly `entries`. Used by expire / delete. */
328
+ declare function writeReflog(ctx: Context, ref: RefName, entries: ReadonlyArray<ReflogEntry>): Promise<void>;
329
+ /** Remove `ref`'s reflog file. A no-op when the file is already absent. */
330
+ declare function deleteReflog(ctx: Context, ref: RefName): Promise<void>;
331
+ /** Every reflog under `.git/logs/`, each as the `RefName` it logs. */
332
+ declare function listReflogs(ctx: Context): Promise<ReadonlyArray<RefName>>;
333
+
191
334
  /**
192
335
  * Read `.git/shallow`. Returns an empty set when the file does not exist or
193
336
  * contains no oids. Malformed lines are tolerated (skipped) — canonical
@@ -250,5 +393,52 @@ declare const updateShallow: (ctx: Context, updates: ShallowUpdate) => Promise<v
250
393
  */
251
394
  declare const synthesizeTreeFromIndex: (ctx: Context, entries: ReadonlyArray<IndexEntry>) => Promise<ObjectId>;
252
395
 
253
- export { applyChangeset, buildIndexFromTree, buildPack, computeChangeset, enumeratePushObjects, fetchPack, materializeTree, readShallow, synthesizeTreeFromIndex, updateShallow };
254
- export type { ApplyChangesetOpts, ApplyChangesetResult, BuildIndexFromTreeOpts, BuildPackInput, BuildPackResult, Changeset, ChangesetEntry, ChangesetStats, EnumeratePushObjectsInput, FetchPackInput, FetchPackResult, MaterializeTreeOpts, MaterializeTreeResult };
396
+ /**
397
+ * Set `key` under `[section]` / `[section "subsection"]`, preserving every
398
+ * other byte verbatim.
399
+ *
400
+ * - existing section with that key ⇒ its value is replaced;
401
+ * - existing section without that key ⇒ a `\t<key> = <value>` line is
402
+ * inserted right after the header;
403
+ * - no such section ⇒ `[section]\n\t<key> = <value>\n` is appended.
404
+ */
405
+ declare const setConfigEntry: (text: string, section: string, subsection: string | undefined, key: string, value: string) => string;
406
+ /** `setConfigEntry` bound to the `[core]` section — kept for legacy callers. */
407
+ declare const setCoreConfigEntry: (text: string, key: string, value: string) => string;
408
+ /** One `key = value` write under `[section]` / `[section "subsection"]`. */
409
+ interface ConfigEntry {
410
+ readonly section: string;
411
+ readonly subsection?: string;
412
+ readonly key: string;
413
+ readonly value: string;
414
+ }
415
+ /**
416
+ * Read `${gitDir}/config` (a missing file is treated as `''`), fold
417
+ * `setConfigEntry` over `entries`, write the result, and invalidate the
418
+ * per-`Context` `readConfig` cache so a later read sees the new values.
419
+ */
420
+ declare const updateConfigEntries: (ctx: Context, entries: ReadonlyArray<ConfigEntry>) => Promise<void>;
421
+ /** Fold a batch of `[core]` `key = value` writes via `updateConfigEntries`. */
422
+ declare const updateCoreConfig: (ctx: Context, entries: Record<string, string>) => Promise<void>;
423
+
424
+ /**
425
+ * Write the `.git/info/sparse-checkout` pattern file. The command tier
426
+ * computes the text (via `serializeCone` or raw non-cone lines); this
427
+ * primitive only persists it (design §7.3).
428
+ *
429
+ * @writes
430
+ * surface: sparseCheckoutFile
431
+ * kind: byte-identical
432
+ * format: git-sparse-checkout
433
+ */
434
+
435
+ /**
436
+ * Persist `text` to `.git/info/sparse-checkout`. The `.git/info` directory is
437
+ * created defensively first — `writeUtf8` creates parents on every adapter,
438
+ * but an explicit `mkdir` keeps the contract clear and survives adapters that
439
+ * tighten that guarantee.
440
+ */
441
+ declare const writeSparsePatternText: (ctx: Context, text: string) => Promise<void>;
442
+
443
+ export { MAX_SPARSE_PATTERN_FILE_BYTES, appendReflog, applyChangeset, buildIndexFromTree, buildPack, computeChangeset, deleteReflog, enumeratePushObjects, enumerateRefs, fetchPack, invalidateConfigCache, isWorkingTreeDirty, listReflogs, loadSparseMatcher, materializeTree, readConfig, readReflog, readShallow, readSparsePatternText, reflogExists, resolveReflogIdentity, setConfigEntry, setCoreConfigEntry, synthesizeTreeFromIndex, updateConfigEntries, updateCoreConfig, updateShallow, writeReflog, writeSparsePatternText };
444
+ export type { ApplyChangesetOpts, ApplyChangesetResult, BuildIndexFromTreeOpts, BuildPackInput, BuildPackResult, Changeset, ChangesetEntry, ChangesetStats, ConfigEntry, EnumeratePushObjectsInput, FetchPackInput, FetchPackResult, MaterializeTreeOpts, MaterializeTreeResult, ParsedConfig };