ci: add single parent commit case on check-signed-off-by script

Signed-off-by: Almir Okato <almir.okato@espressif.com>
This commit is contained in:
Almir Okato 2023-01-27 16:15:30 -03:00 committed by Fabio Utzig
parent 5047f032c9
commit 3eb0681273
1 changed files with 10 additions and 7 deletions

View File

@ -12,18 +12,21 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# this retrieves the merge commit created by GH
parents=(`git log -n 1 --format=%p HEAD`) parents=(`git log -n 1 --format=%p HEAD`)
if [[ "${#parents[@]}" -ne 2 ]]; then if [[ "${#parents[@]}" -eq 1 ]]; then
echo "This PR's merge commit is missing a parent!" # CI doesn't use a merge commit
commits=$(git show -s --format=%h ${parents})
elif [[ "${#parents[@]}" -eq 2 ]]; then
# CI uses a merge commit, eg GH / Travis
from="${parents[0]}"
into="${parents[1]}"
commits=$(git show -s --format=%h ${from}..${into})
else
echo "Unexpected behavior, cannot verify more than 2 parent commits!"
exit 1 exit 1
fi fi
from="${parents[0]}"
into="${parents[1]}"
commits=$(git show -s --format=%h ${from}..${into})
has_commits=false has_commits=false
for sha in $commits; do for sha in $commits; do
author="Signed-off-by: $(git show -s --format="%an <%ae>" ${sha})" author="Signed-off-by: $(git show -s --format="%an <%ae>" ${sha})"