From 0705c2779d53e96c9a624b33ed48ef018b4e96f1 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 1 Jun 2023 16:09:28 -0400 Subject: [PATCH] hvsp: add support for compile_branch Apply start/end commits from base_branch to create patch files, and also apply start/end commits from compile_branch to compile them. This allows to have commits with prerequisite patches (ex: board files defconfig/dts) which won't be recorded as part of the base-commit info. --- scripts/kernel-send-patches.sh | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/scripts/kernel-send-patches.sh b/scripts/kernel-send-patches.sh index e98cd3f..daf7708 100755 --- a/scripts/kernel-send-patches.sh +++ b/scripts/kernel-send-patches.sh @@ -156,6 +156,11 @@ if [ x"${base_branch}" = x"" ]; then exit 1 fi +if [ x"${compile_branch}" = x"" ]; then + echo "Missing compile_branch shell variable" + exit 1 +fi + if [ x"${base_commit}" = x"" ]; then base_commit="auto" fi @@ -311,11 +316,29 @@ fi sed -i -e "s@COMPILE_CMD@${compile_cmd}@" ${compile_script} chmod u+x ${compile_script} -# Compile each commit. Create branch to avoid "detached HEAD" state, and also to -# keep a record of what was sent: -git rebase --exec=${compile_script} ${base_branch} +# Create temporary branch for compilation, based on compile_branch: +temp_compile_branch="${patches_branch}_compile" + +if git branch | grep -q ${temp_compile_branch}; then + git branch -D ${temp_compile_branch} +fi + +git checkout -b ${temp_compile_branch} ${compile_branch} + +# Make sure temp_compile_branch is rebased on base_branch: +git rebase ${base_branch} + +# Apply all of our commits to temp_compile_branch: +git cherry-pick ${COMMIT_START_SHA1}..${COMMIT_END_SHA1} + +# Compile and test each commit: +git rebase --exec=${compile_script} ${compile_branch} + git checkout ${orig_branch} +# Remove temporary branch: +git branch -D ${temp_compile_branch} + # Send email(s) git send-email ${DRY_RUN} --annotate --thread --no-chain-reply-to \ ${TO_OPTS} ${CC_OPTS} \ -- 2.20.1