spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

Revert "fix(diff): preserve hunks when Git forces colored output"Browse files
poteat authored 25 days ago parent 6eb61ae · commit 4918baab85e4
2 changed files+0 -37compared with 6eb61ae
Mmods/diff/hooks/git/argv/diff-leading-args.ts
Mmods/diff/tests/git/fetch-diff.test.ts
@@ -13,7 +13,6 @@
1313 '-c',
1414 'core.quotePath=false',
1515 'diff',
16- '--no-color',
1716 '--no-ext-diff',
1817 '--no-textconv',
1918 '--ignore-submodules=dirty',
@@ -148,42 +148,6 @@
148148 ).toBe(true)
149149 })
150150
151- test("forced git colors do not hide a changed file's hunks", async () => {
152- const deps = depsOf({
153- 'HEAD --shortstat': Fixtures.ok(
154- ' 1 file changed, 1 insertion(+), 1 deletion(-)',
155- ),
156- 'HEAD --numstat': Fixtures.ok('1\t1\ta.ts\0'),
157- 'ls-files': Fixtures.ok(),
158- })
159-
160- const git = Fixtures.scriptedGitOf({
161- '--no-color': Fixtures.ok('@@ -1 +1 @@\n-old\n+new\n'),
162- diff: Fixtures.ok(
163- '\x1b[36m@@ -1 +1 @@\x1b[m\n\x1b[31m-old\x1b[m\n' +
164- '\x1b[32m+\x1b[m\x1b[32mnew\x1b[m\n',
165- ),
166- })
167-
168- const outcome = await Git.fetchDiff(deps, 'uncommitted')
169- const data = outcome.kind === 'data' ? outcome.data : null
170- const [row] = data?.files ?? []
171-
172- expect(data?.stats).toEqual({
173- filesCount: 1,
174- linesAdded: 1,
175- linesRemoved: 1,
176- })
177-
178- expect(
179- data && row ? await Git.fetchFileHunks(git.run, data, row) : null,
180- ).toEqual({
181- hunks: [{ oldStart: 1, newStart: 1, lines: ['-old', '+new'] }],
182- isTruncated: false,
183- isLarge: false,
184- })
185- })
186-
187151 test('uncommitted mode drops pre-session untracked files', async () => {
188152 const outcome = await Git.fetchDiff(
189153 depsOf(