From ac4c05774096cf483e14566db2d8867244fac549 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 18 Sep 2020 15:36:04 -0300 Subject: [PATCH] Fix post-merge.sh exit status in some cases This commit tweaks the function runOnChange() to make sure it always returns the correct exit status. Before this change, this function would return 1 instead of 0 when there was no change to composer.lock and package-lock.json in the commits that were merged. This resulted in husky mistakenly reporting a failure when actually the post-merge script succeeded. --- bin/post-merge.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/post-merge.sh b/bin/post-merge.sh index 67196fe5f18..687642a0b04 100755 --- a/bin/post-merge.sh +++ b/bin/post-merge.sh @@ -3,7 +3,10 @@ changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" runOnChange() { - echo "$changedFiles" | grep -q "$1" && eval "$2" + if echo "$changedFiles" | grep -q "$1" + then + eval "$2" + fi } runOnChange "package-lock.json" "npm install"