mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 03:23:57 +08:00
fix(@angular/cli): allow update when git is unclean outside the workspace
This commit is contained in:
parent
efe463371d
commit
09149fe5e4
@ -346,10 +346,24 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
|
|||||||
checkCleanGit() {
|
checkCleanGit() {
|
||||||
try {
|
try {
|
||||||
const result = execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
const result = execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
||||||
|
if (result.trim().length === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return result.trim().length === 0;
|
// Only files inside the workspace root are relevant
|
||||||
} catch {
|
for (const entry of result.split('\n')) {
|
||||||
return true;
|
const relativeEntry = path.relative(
|
||||||
}
|
path.resolve(this.workspace.root),
|
||||||
|
path.resolve(entry.slice(3).trim()),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!relativeEntry.startsWith('..') && !path.isAbsolute(relativeEntry)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch { }
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user