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.
This commit is contained in:
parent
d99053dbed
commit
ac4c057740
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue