@pmelab/gtd 64.1.2 → 64.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.
@@ -131,7 +131,12 @@ export interface GitTier {
131
131
  const noopNarratorLayer = Narrator.layer(() => {}, false)
132
132
 
133
133
  const gitExecIn = (dir: string, ...args: string[]): string =>
134
- execSync(`git ${args.join(" ")}`, { cwd: dir, encoding: "utf8", stdio: "pipe" }).trim()
134
+ execSync(`git ${args.join(" ")}`, {
135
+ cwd: dir,
136
+ encoding: "utf8",
137
+ stdio: "pipe",
138
+ maxBuffer: 1 << 28,
139
+ }).trim()
135
140
 
136
141
  const makeLiveTier = (initialCommit = true): GitTier => {
137
142
  // realpath'd once here so `t.root` matches `git rev-parse --show-toplevel`'s
@@ -150,6 +155,7 @@ const makeLiveTier = (initialCommit = true): GitTier => {
150
155
  cwd: root,
151
156
  env: commitEnv(),
152
157
  stdio: "pipe",
158
+ maxBuffer: 1 << 28,
153
159
  })
154
160
  gitExec("init")
155
161
  gitExec(`config user.email "test@test.com"`)
@@ -432,6 +438,7 @@ export const CONTRACT_COVERED_OPERATIONS: ReadonlySet<keyof GitOperations> = new
432
438
  "subjectHistory",
433
439
  "readFileAtRef",
434
440
  "changedPaths",
441
+ "untrackedPaths",
435
442
  "stagedPaths",
436
443
  "diffPaths",
437
444
  "authorIdent",
@@ -1098,6 +1105,24 @@ export const runGitServiceContract = (makeTier: () => GitTier): void => {
1098
1105
  expect(await runGit(t, (g) => g.changedPaths())).toEqual([])
1099
1106
  })
1100
1107
 
1108
+ it("classifies an untracked set far past the argument limit, against an older base", async () => {
1109
+ const long = "d".repeat(200)
1110
+ const paths = Array.from({ length: 4000 }, (_, i) => `${long}/${long}/${long}/f${i}.txt`)
1111
+ t.seed.commit("chore: seed", { "kept.txt": "seed" })
1112
+ const seed = t.observe.resolveRef("HEAD")
1113
+ t.seed.commit(
1114
+ "chore: files",
1115
+ Object.fromEntries(paths.map((p, i) => [p, i % 2 === 0 ? "same" : "old"])),
1116
+ )
1117
+ const head = t.observe.resolveRef("HEAD")
1118
+ t.seed.mixedReset(seed)
1119
+ paths.forEach((p, i) => t.seed.writeFile(p, i % 2 === 0 ? "same" : "new"))
1120
+ const changed = await runGit(t, (g) => g.changedPaths(head))
1121
+ expect(changed.length).toBe(2000)
1122
+ expect(changed.every((c) => c.status === "M")).toBe(true)
1123
+ expect((await runGit(t, (g) => g.untrackedPaths())).length).toBe(4000)
1124
+ })
1125
+
1101
1126
  it("ignores an edit staged and then reverted in the worktree", async () => {
1102
1127
  t.seed.commit("chore: seed", { "a.txt": "1" })
1103
1128
  t.seed.writeFile("a.txt", "2")
@@ -298,6 +298,11 @@ export class InMemRepo {
298
298
  return diffTrees(baseTree, worktreeTree)
299
299
  }
300
300
 
301
+ /** Worktree paths the index does not carry. */
302
+ untrackedPaths(): string[] {
303
+ return [...this.worktree.keys()].filter((k) => !this.index.has(k))
304
+ }
305
+
301
306
  /** The index vs HEAD — the port's `stagedPaths`. */
302
307
  stagedPaths(): Array<{ path: string; status: string }> {
303
308
  return diffTrees(this.treeAt(undefined), this.index)