Skip to content

Bug 1996139: chore(verify-commits): initialize variable #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions scripts/verify_commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function verify_staging_sync() {
local staging_dir="staging/${remote}"

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


local invalid
invalid=false
if (( ${#upstream_repos[@]} != 1 )); then
err "downstream staging commit ${downstream_commit} references an invalid number of repos:"
err "${upstream_repos[@]}"
err "downstream staging commit ${downstream_commit} references an invalid number of repos: ${#upstream_repos[@]}"
err "staging commits must reference a single upstream repo"
invalid=true
fi

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

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