From 126967cb9092393c6eec1c7ea521adb474a1c091 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 4 Jan 2017 11:47:33 +0000 Subject: [PATCH 1/3] release.sh: Bail early if there are uncommitted changes --- release.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/release.sh b/release.sh index e71f7d40232..9f4e22d0454 100755 --- a/release.sh +++ b/release.sh @@ -32,6 +32,18 @@ if [ "$ret" -eq 0 ]; then exit fi +git diff-index --quiet --cached HEAD || ret=$? +if [ "$ret" -eq 1 ]; then + echo "this git checkout has staged (uncommitted) changes. Refusing to release." + exit +fi + +git diff-files --quiet || ret=$? +if [ "$ret" -eq 1 ]; then + echo "this git checkout has uncommitted changes. Refusing to release." + exit +fi + skip_changelog= skip_jsdoc= changelog_file="CHANGELOG.md" From 1b222249c4e8b533b331f84372c75f6d8c6684bd Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 4 Jan 2017 11:56:01 +0000 Subject: [PATCH 2/3] Reset ret before reusing it --- release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/release.sh b/release.sh index 9f4e22d0454..33e3e9c1b14 100755 --- a/release.sh +++ b/release.sh @@ -32,6 +32,7 @@ if [ "$ret" -eq 0 ]; then exit fi +ret=0 git diff-index --quiet --cached HEAD || ret=$? if [ "$ret" -eq 1 ]; then echo "this git checkout has staged (uncommitted) changes. Refusing to release." From df7ac77113bc5fb89e1d5b5ee8fd8d50f8288e5c Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 4 Jan 2017 13:57:51 +0000 Subject: [PATCH 3/3] Review comments --- release.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/release.sh b/release.sh index 33e3e9c1b14..f8dafb7763f 100755 --- a/release.sh +++ b/release.sh @@ -32,15 +32,12 @@ if [ "$ret" -eq 0 ]; then exit fi -ret=0 -git diff-index --quiet --cached HEAD || ret=$? -if [ "$ret" -eq 1 ]; then +if ! git diff-index --quiet --cached HEAD; then echo "this git checkout has staged (uncommitted) changes. Refusing to release." exit fi -git diff-files --quiet || ret=$? -if [ "$ret" -eq 1 ]; then +if ! git diff-files --quiet; then echo "this git checkout has uncommitted changes. Refusing to release." exit fi