From a3313709ea28ac438357cbddffa754b1e4e52ff0 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Fri, 5 Jun 2020 23:49:45 +0200 Subject: [PATCH] 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 --- dev-infra/utils/git.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-infra/utils/git.ts b/dev-infra/utils/git.ts index d234c1d570..5ff7a17ab5 100644 --- a/dev-infra/utils/git.ts +++ b/dev-infra/utils/git.ts @@ -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. */