mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
There is an `exec()` helper provided by `utils/shelljs.ts`, which is a
wrapper around ShellJS' `exec()` with some default options (currently
`silent: true`). The intention is to avoid having to pass these options
to every invocation of the `exec()` function.
This commit updates all code inside `dev-infra/` to use this helper
whenever possible).
NOTE: For simplicity, the `utils/shelljs` helper does not support some
of the less common call signatures of the original `exec()`
helper, so in some cases we still need to use the original.
PR Close #37444
20 lines
512 B
TypeScript
20 lines
512 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {exec} from './shelljs';
|
|
|
|
|
|
/** Whether the repo has any local changes. */
|
|
export function hasLocalChanges() {
|
|
return !!exec(`git status --porcelain`).trim();
|
|
}
|
|
|
|
/** Get the currently checked out branch. */
|
|
export function getCurrentBranch() {
|
|
return exec(`git symbolic-ref --short HEAD`).trim();
|
|
}
|