From da2b210012c549bb3fefa974fb036a8cbb78f8d4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 27 Dec 2021 07:25:53 -0800 Subject: [PATCH] tools: do not mask errors on multiple commit retrieval In commit-queue.sh, the assignment to `commits` will succeed and the script will continue if one of the two `git` commands fails, even with `-e` set. Split it into three separate assignments so that failures in the `git` commands will be clearly logged and cause the script to exit with a failure status code. --- tools/actions/commit-queue.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/actions/commit-queue.sh b/tools/actions/commit-queue.sh index bb231c6a0b9b84..bf6e06173c8138 100755 --- a/tools/actions/commit-queue.sh +++ b/tools/actions/commit-queue.sh @@ -72,7 +72,9 @@ for pr in "$@"; do fi if [ -z "$MULTIPLE_COMMIT_POLICY" ]; then - commits="$(git rev-parse $UPSTREAM/$DEFAULT_BRANCH)...$(git rev-parse HEAD)" + start_sha=$(git rev-parse $UPSTREAM/$DEFAULT_BRANCH) + end_sha=$(git rev-parse HEAD) + commits="${start_sha}...${end_sha}" if ! git push $UPSTREAM $DEFAULT_BRANCH >> output 2>&1; then commit_queue_failed "$pr"