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> {
359
359
360
360
checkCleanGit ( ) {
361
361
try {
362
+ const topLevel = execSync ( 'git rev-parse --show-toplevel' , { encoding : 'utf8' , stdio : 'pipe' } ) ;
362
363
const result = execSync ( 'git status --porcelain' , { encoding : 'utf8' , stdio : 'pipe' } ) ;
363
364
if ( result . trim ( ) . length === 0 ) {
364
365
return true ;
@@ -368,7 +369,7 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
368
369
for ( const entry of result . split ( '\n' ) ) {
369
370
const relativeEntry = path . relative (
370
371
path . resolve ( this . workspace . root ) ,
371
- path . resolve ( entry . slice ( 3 ) . trim ( ) ) ,
372
+ path . resolve ( topLevel . trim ( ) , entry . slice ( 3 ) . trim ( ) ) ,
372
373
) ;
373
374
374
375
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