mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +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() {
|
||||
try {
|
||||
const result = execSync('git status --porcelain', { encoding: 'utf8', stdio: 'pipe' });
|
||||
if (result.trim().length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return result.trim().length === 0;
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
// Only files inside the workspace root are relevant
|
||||
for (const entry of result.split('\n')) {
|
||||
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