Create new branch from base_branch, and apply all our patches onto it
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 13 Jan 2023 19:09:51 +0000 (14:09 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 1 Jun 2023 19:16:14 +0000 (15:16 -0400)
scripts/kernel-send-patches.sh

index 4037d61..28af710 100755 (executable)
@@ -237,8 +237,10 @@ if git branch | grep -q ${patches_branch}; then
     git branch -D ${patches_branch}
 fi
 
-git checkout -b ${patches_branch} ${COMMIT_END_SHA1}
+# Create new branch from base_branch, and apply all our patches onto it:
+git checkout -b ${patches_branch} ${base_branch}
 git branch --set-upstream-to ${base_branch}
+git cherry-pick ${COMMIT_START_SHA1}..${COMMIT_END_SHA1}
 
 GIT_FORMAT_PATCH_OPTS="--base=${base_commit}"
 
@@ -250,7 +252,7 @@ if [ x"${series}" != x"" ]; then
     GIT_FORMAT_PATCH_OPTS="${GIT_FORMAT_PATCH_OPTS} -v ${series}"
 fi
 
-git format-patch ${GIT_FORMAT_PATCH_OPTS} --output-directory=${srcdir} ${COMMIT_START_SHA1}..${COMMIT_END_SHA1}
+git format-patch ${GIT_FORMAT_PATCH_OPTS} --output-directory=${srcdir} ${base_branch}
 
 if [ x"${cover}" = x"yes" ]; then
     # Replace subject line in cover letter:
@@ -293,7 +295,7 @@ 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} ${COMMIT_START_SHA1}
+git rebase --exec=${compile_script} ${base_branch}
 git checkout ${orig_branch}
 
 # Send email(s)