fix(dev-infra): local changes check not working (#37489)

Looks like we broke the `hasLocalChanges` check in the git client
when we moved it over from the merge script. The problem is that
we are using `git` in the first argument of `git.run`. That
means that we under-the-hood run `git git <..>`.

This commit fixes that, but also switches to a better variant
for ensuring no local changes because it exits with non-zero
when there are local changes.

PR Close #37489
This commit is contained in:
Paul Gschwendtner 2020-06-05 23:49:45 +02:00 committed by atscott
parent 0eacba5829
commit a3313709ea
1 changed files with 1 additions and 1 deletions

View File

@ -142,7 +142,7 @@ export class GitClient {
/** Whether the repo has any local changes. */
hasLocalChanges(): boolean {
return !!this.runGraceful(['git', 'status', '--porcelain']).stdout.trim();
return this.runGraceful(['diff-index', '--quiet', 'HEAD']).status !== 0;
}
/** Sanitizes a given message by omitting the provided Github token if present. */