diff --git a/common/changes/@microsoft/rush/fix-pre-push-hook_2023-07-20-21-26.json b/common/changes/@microsoft/rush/fix-pre-push-hook_2023-07-20-21-26.json new file mode 100644 index 00000000000..ea79c9cc045 --- /dev/null +++ b/common/changes/@microsoft/rush/fix-pre-push-hook_2023-07-20-21-26.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Fix an issue where the git pre-push hook would allow push to go through if the script exited with error.", + "type": "patch" + } + ], + "packageName": "@microsoft/rush" +} diff --git a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts index ae2ee615e67..3c56a5e86b7 100644 --- a/libraries/rush-lib/src/logic/base/BaseInstallManager.ts +++ b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts @@ -483,6 +483,7 @@ fi : ''; const hookFileContent: string = `#!/bin/bash +set -e SCRIPT_DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_IMPLEMENTATION_PATH="$SCRIPT_DIR/${hookRelativePath}/${filename}"