Skip to content

Commit b5600cf

Browse files
Merge pull request #171 from njhale/fix/verify-commits
Bug 1996139: chore(verify-commits): initialize variable
2 parents 40493e6 + 6917112 commit b5600cf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

scripts/verify_commits.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function verify_staging_sync() {
1818
local staging_dir="staging/${remote}"
1919

2020
local outside_staging
21-
outside_staging="$(git show --name-only "${downstream_commit}" -- ":!${staging_dir}" ':!vendor :!manifests')"
21+
outside_staging="$(git show --name-only "${downstream_commit}" -- ":!${staging_dir}" ':!vendor' ':!manifests')"
2222
if [[ -n "${outside_staging}" ]]; then
2323
err "downstream staging commit ${downstream_commit} changes files outside of ${staging_dir}, vendor, and manifests directories"
2424
err "${outside_staging}"
@@ -60,16 +60,15 @@ function upstream_ref() {
6060

6161

6262
local invalid
63+
invalid=false
6364
if (( ${#upstream_repos[@]} != 1 )); then
64-
err "downstream staging commit ${downstream_commit} references an invalid number of repos:"
65-
err "${upstream_repos[@]}"
65+
err "downstream staging commit ${downstream_commit} references an invalid number of repos: ${#upstream_repos[@]}"
6666
err "staging commits must reference a single upstream repo"
6767
invalid=true
6868
fi
6969

7070
if (( ${#upstream_commits[@]} != 1 )); then
71-
err "downstream staging commit ${downstream_commit} references an invalid number of upstream commits:"
72-
err "${upstream_commits[@]}"
71+
err "downstream staging commit ${downstream_commit} references an invalid number of upstream commits: ${#upstream_commits[@]}"
7372
err "staging commits must reference a single upstream commit"
7473
invalid=true
7574
fi
@@ -121,7 +120,7 @@ function main() {
121120
info "verifying ${short}..."
122121
info "$(git log -n 1 "${commit}")"
123122

124-
mapfile -t sr < <(upstream_ref "${commit}" || exit 1)
123+
sr=( $(upstream_ref "${commit}") ) || exit 1
125124
if (( ${#sr[@]} < 2 )); then # the ref contains a tuple if the values were properly parsed from the commit message
126125
# couldn't find upstream cherry-pick reference in the commit message
127126
# assume it's downstream-only commit

0 commit comments

Comments
 (0)