File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
packages/angular/cli/commands Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -346,10 +346,24 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
346346 checkCleanGit ( ) {
347347 try {
348348 const result = execSync ( 'git status --porcelain' , { encoding : 'utf8' , stdio : 'pipe' } ) ;
349+ if ( result . trim ( ) . length === 0 ) {
350+ return true ;
351+ }
349352
350- return result . trim ( ) . length === 0 ;
351- } catch {
352- return true ;
353- }
353+ // Only files inside the workspace root are relevant
354+ for ( const entry of result . split ( '\n' ) ) {
355+ const relativeEntry = path . relative (
356+ path . resolve ( this . workspace . root ) ,
357+ path . resolve ( entry . slice ( 3 ) . trim ( ) ) ,
358+ ) ;
359+
360+ if ( ! relativeEntry . startsWith ( '..' ) && ! path . isAbsolute ( relativeEntry ) ) {
361+ return false ;
362+ }
363+ }
364+
365+ } catch { }
366+
367+ return true ;
354368 }
355369}
You can’t perform that action at this time.
0 commit comments