File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
packages/angular/cli/commands
tests/legacy-cli/e2e/tests/misc Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,7 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
359359
360360 checkCleanGit ( ) {
361361 try {
362+ const topLevel = execSync ( 'git rev-parse --show-toplevel' , { encoding : 'utf8' , stdio : 'pipe' } ) ;
362363 const result = execSync ( 'git status --porcelain' , { encoding : 'utf8' , stdio : 'pipe' } ) ;
363364 if ( result . trim ( ) . length === 0 ) {
364365 return true ;
@@ -368,7 +369,7 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
368369 for ( const entry of result . split ( '\n' ) ) {
369370 const relativeEntry = path . relative (
370371 path . resolve ( this . workspace . root ) ,
371- path . resolve ( entry . slice ( 3 ) . trim ( ) ) ,
372+ path . resolve ( topLevel . trim ( ) , entry . slice ( 3 ) . trim ( ) ) ,
372373 ) ;
373374
374375 if ( ! relativeEntry . startsWith ( '..' ) && ! path . isAbsolute ( relativeEntry ) ) {
Original file line number Diff line number Diff line change 1+ import { createDir , writeFile } from '../../utils/fs' ;
2+ import { expectToFail } from '../../utils/utils' ;
3+ import { getGlobalVariable } from '../../utils/env' ;
4+ import { ng , silentGit } from '../../utils/process' ;
5+ import { prepareProjectForE2e } from '../../utils/project'
6+
7+ export default async function ( ) {
8+ process . chdir ( getGlobalVariable ( 'tmp-root' ) ) ;
9+
10+ await createDir ( './subdirectory' ) ;
11+ process . chdir ( './subdirectory' ) ;
12+
13+ await silentGit ( 'init' , '.' ) ;
14+
15+ await ng ( 'new' , 'subdirectory-test-project' , '--skip-install' ) ;
16+ process . chdir ( './subdirectory-test-project' ) ;
17+ await prepareProjectForE2e ( 'subdirectory-test-project' ) ;
18+
19+ await writeFile ( '../added.ts' , 'console.log(\'created\');\n' ) ;
20+ await silentGit ( 'add' , '../added.ts' ) ;
21+
22+ const { message } = await expectToFail ( ( ) => ng ( 'update' , '--all' ) ) ;
23+ if ( message && message . includes ( 'Repository is not clean.' ) ) {
24+ throw new Error ( 'Expected clean repository' ) ;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments