Skip to content
Snippets Groups Projects
Commit a604c152 authored by Mattijs Korpershoek's avatar Mattijs Korpershoek
Browse files

commit-binaries: Disable strict mode in commit_msg_body()

It's possible that some subcommands (such as git remote get-url
or repo info) fail. In that case, commit_msg_body() aborts immediately
because of the shell opts we use (-e, -u, -o pipefail).

When commit_msg_body() aborts, we get empty commit messages bodies,
such as [1].

Disable strict mode to avoid empty commit messages bodies as we prefer to have
some information than nothing at all.

[1] baylibre/ti/android/aosp/vendor/ti/am62x@cf301774


Signed-off-by: default avatarMattijs Korpershoek <mkorpershoek@baylibre.com>
parent 523b1452
No related branches found
No related tags found
1 merge request!45commit-binaries: Disable strict mode in commit_msg_body()
......@@ -111,16 +111,20 @@ function commit_msg_body {
local head=""
local branch=""
# Temporarily disable strict script mode
# Because some functions might fail.
# When fails happens, we don't want the whole function to abort
# It's better to have a partial commit message than an empty one
set +e
set +u
set +o pipefail
for project in "${projects[@]}"; do
pushd "${from_repo}/${project}"
body+="- Project: ${project}:\n"
for remote_name in $remote_name_list; do
# Temporarily disable exit on error since
# the remote name might not exist
set +e
remote_url=$(git remote get-url $remote_name)
set -e
if [[ "$remote_url" != "" ]]; then
# We found the url matching the remote
# early exit the loop
......@@ -138,6 +142,10 @@ function commit_msg_body {
popd
done
set -e
set -u
set -o pipefail
echo "${body}"
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment