X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=scripts%2Fkernel-send-patches.sh;h=28af710353b7f3df5cc42d24e3c763a54c6a68bc;hb=6851f8a9721524f4fe1ffa70ca994db2b7188b96;hp=6cca90dbad66097572bdd2217591e0186a93df16;hpb=4bdf58b65635c9428ac7647d5c3e1cb451c08fa5;p=hvutilities.git diff --git a/scripts/kernel-send-patches.sh b/scripts/kernel-send-patches.sh index 6cca90d..28af710 100755 --- a/scripts/kernel-send-patches.sh +++ b/scripts/kernel-send-patches.sh @@ -21,8 +21,15 @@ catch() echo "Error $1 occurred" if [ x"${orig_branch}" != x"" ]; then + if git status | grep -q "currently cherry-picking commit"; then + git cherry-pick --abort + fi + + if git status | grep -q "currently editing a commit while rebasing branch"; then + git rebase --abort + fi + git checkout ${orig_branch} - git rebase --abort fi fi @@ -207,6 +214,10 @@ rm -rf ${srcdir}/*.patch # If the cover letter is not between start and end commits, save a copy: cp ${srcdir}/cover-letter.txt /tmp +if [ x"${init_cmd}" != x"" ]; then + ${init_cmd} +fi + patches_branch="kernel_send_patches" if [ x"${series}" != x"" ]; then @@ -226,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}" @@ -239,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: @@ -282,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)