From 0230f6f57e10222cbfc6f8993354da4c16ef3d8e Mon Sep 17 00:00:00 2001 From: John Brunton Date: Mon, 27 Jul 2020 13:43:26 +0100 Subject: [PATCH] use git diff instead of diff-index to check for clean dir --- lib/plugin/git/Git.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/plugin/git/Git.js b/lib/plugin/git/Git.js index 62812c10..27a46a03 100644 --- a/lib/plugin/git/Git.js +++ b/lib/plugin/git/Git.js @@ -89,7 +89,10 @@ class Git extends GitBase { } isWorkingDirClean() { - return this.exec('git diff-index --quiet HEAD --', { options }).then( + // Note: the update-index is required here for cases where files may be touched/recreated + // during a build/test hook. Git will mark those as potentially changed, but won't diff them + // until the index is updated. See also https://github.com/release-it/release-it/issues/687 + return this.exec('git diff --quiet HEAD', { options }).then( () => true, () => false );