Skip to content

Commit

Permalink
backporting: Fix pattern to handle commit subjects that begin with a …
Browse files Browse the repository at this point in the history
…space

Commit da04e68 (" bpf/nat: introduce snat_v*_handle_mapping() nat and
rev_nat") has a subject that starts with a space, which results in this
warning when trying to backport it:

     |  Warning: No commit correlation found!    via b968e9d ("bpf/nat: introduce snat_v*_handle_mapping() nat and rev_nat")

Fix parsing so that it doesn't trim leading and trailing spaces from the
commit subject.

Signed-off-by: Maxim Mikityanskiy <maxim@isovalent.com>
  • Loading branch information
gentoo-root authored and borkmann committed Jun 26, 2023
1 parent 7ed6b24 commit 5d98b19
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions contrib/backporting/check-stable
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ generate_commit_list_for_pr () {
echo " ---------- -------------------"
echo " v (start)"
while read entry; do
entry_array=($entry)
entry_id=${entry_array[0]}
entry_sha=${entry_array[1]}
entry_sub=${entry_array[@]:2}
entry_id=$(echo "$entry" | cut -d ' ' -f 1)
entry_sha=$(echo "$entry" | cut -d ' ' -f 2)
entry_sub=$(echo "$entry" | cut -d ' ' -f 3-)
entry_sub_re="^$(sed 's/[.^$*+?()[{\|]/\\&/g' <<< "$entry_sub")$" # adds backslashes for extended regex
related_commits="$(git log --since="1year" --pretty="%H" --no-merges --extended-regexp --grep "$entry_sub_re" $REMOTE/main)"
found_commit=0
Expand Down

0 comments on commit 5d98b19

Please sign in to comment.