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 @@ -551,6 +551,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
551
551
552
552
checkCleanGit ( ) {
553
553
try {
554
+ const topLevel = execSync ( 'git rev-parse --show-toplevel' , { encoding : 'utf8' , stdio : 'pipe' } ) ;
554
555
const result = execSync ( 'git status --porcelain' , { encoding : 'utf8' , stdio : 'pipe' } ) ;
555
556
if ( result . trim ( ) . length === 0 ) {
556
557
return true ;
@@ -560,7 +561,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
560
561
for ( const entry of result . split ( '\n' ) ) {
561
562
const relativeEntry = path . relative (
562
563
path . resolve ( this . workspace . root ) ,
563
- path . resolve ( entry . slice ( 3 ) . trim ( ) ) ,
564
+ path . resolve ( topLevel . trim ( ) , entry . slice ( 3 ) . trim ( ) ) ,
564
565
) ;
565
566
566
567
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