@@ -518,6 +518,29 @@ describe("loadAppBootstrap", () => {
518518 expect ( paths ) . toHaveLength ( fixtureFiles . length ) ;
519519 } ) ;
520520
521+ test ( "loads untracked files even when diff.external is configured in the repo" , async ( ) => {
522+ // Regression: a user-configured `diff.external` (e.g. difftastic) silently replaces
523+ // git's unified-diff output, which left the untracked-file synthesizer with patch
524+ // text Pierre couldn't parse and threw "Expected one parsed file ..., got 0".
525+ const dir = createTempRepo ( "hunk-git-untracked-ext-diff-" ) ;
526+
527+ writeFileSync ( join ( dir , "tracked.ts" ) , "export const tracked = 1;\n" ) ;
528+ git ( dir , "add" , "tracked.ts" ) ;
529+ git ( dir , "commit" , "-m" , "initial" ) ;
530+
531+ git ( dir , "config" , "diff.external" , "git --version" ) ;
532+ writeFileSync ( join ( dir , "untracked.ts" ) , "export const added = true;\n" ) ;
533+
534+ const bootstrap = await loadFromRepo ( dir , {
535+ kind : "vcs" ,
536+ staged : false ,
537+ options : { mode : "auto" } ,
538+ } ) ;
539+
540+ expect ( bootstrap . changeset . files . map ( ( file ) => file . path ) ) . toEqual ( [ "untracked.ts" ] ) ;
541+ expect ( bootstrap . changeset . files [ 0 ] ?. patch ) . toContain ( "new file mode" ) ;
542+ } ) ;
543+
521544 test ( "still shows an untracked agent sidecar when it lives inside the repo" , async ( ) => {
522545 const dir = createTempRepo ( "hunk-git-agent-sidecar-" ) ;
523546
0 commit comments