@@ -105,6 +105,19 @@ async function main(packageName: string) {
105105 git . run ( [ 'add' , '-A' ] , { cwd : tmpDir } ) ;
106106 git . run ( [ 'commit' , '-m' , 'Delete skipped files for diff' ] , { cwd : tmpDir } ) ;
107107
108+ // Remove all old content, so that e.g. potential file renames or new files are properly
109+ // detected.
110+ const removeAllOldContentTasks : Promise < void > [ ] = [ ] ;
111+ for ( const subentry of await glob ( '**/*' , {
112+ dot : true ,
113+ cwd : tmpDir ,
114+ onlyFiles : true ,
115+ ignore : [ '.git' ] ,
116+ } ) ) {
117+ removeAllOldContentTasks . push ( fs . promises . rm ( path . join ( tmpDir , subentry ) , { maxRetries : 3 } ) ) ;
118+ }
119+ await Promise . all ( removeAllOldContentTasks ) ;
120+
108121 const copyTasks : Promise < void > [ ] = [ ] ;
109122 for ( const subentry of await glob ( '**/*' , {
110123 dot : true ,
@@ -126,7 +139,9 @@ async function main(packageName: string) {
126139
127140 git . run ( [ 'config' , 'core.filemode' , 'false' ] , { cwd : tmpDir } ) ;
128141
129- const diff = git . run ( [ 'diff' , '--color' ] , { cwd : tmpDir } ) . stdout ;
142+ // Add all files so that new untracked files are also visible in the diff.
143+ git . run ( [ 'add' , '-A' ] , { cwd : tmpDir } ) ;
144+ const diff = git . run ( [ 'diff' , 'HEAD' , '--color' ] , { cwd : tmpDir } ) . stdout ;
130145
131146 console . info ( '\n\n----- Diff ------' ) ;
132147 console . info ( diff ) ;
0 commit comments