From 0fb8e60326c67bbfd0dd0dd8c15f99b812128ed3 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Fri, 26 Jul 2019 15:46:47 +1000 Subject: [PATCH] do_merge: factor out manaul fix up points --- do_merge | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/do_merge b/do_merge index 243fc50..2e3cf9c 100755 --- a/do_merge +++ b/do_merge @@ -33,6 +33,19 @@ execute() return "${PIPESTATUS[0]}" } +fix_up() +{ + if [ -n "$1" ]; then + linux-next-notify "$1" + fi + if [ -n "$2" ]; then + printf '%s\n' "$2" 1>&2 + fi + if ! bash -i; then + exit + fi +} + if [ -z "$start_from" ]; then cp /dev/null "$LOG_FILE" execute date -R @@ -69,8 +82,7 @@ for h in $heads; do if [ -f "../pre-merge/$tree" ]; then while read -r p <&7; do if ! "$bin_dir/do_patch" -n "$p"; then - linux-next-notify "premerge patch failed" - bash -i || exit + fix_up "premerge patch failed" fi 7<&- done 7<"../pre-merge/$tree" fi @@ -83,17 +95,15 @@ for h in $heads; do check_unmerged_files "$tree" if git diff 2>&1 | grep -E -q '<<<<<|^\*'; then - linux-next-notify "new conflict found merging $tree" if [ -f "../merge-fixes/$tree" ]; then echo "Merge fixes exist for this tree:" cat "../merge-fixes/$tree" fi - bash -i || exit + fix_up "new conflict found merging $tree" fi # if [ "$(git status --porcelain)" ]; then if ! execute git commit --no-edit -v -a; then - linux-next-notify "next commit failed for $tree" - bash -i || exit + fix_up "next commit failed for $tree" fi execute git diff -M --stat --summary 'HEAD^..' # fi @@ -101,8 +111,7 @@ for h in $heads; do if [ -f "../merge-fixes/$tree" ]; then while read -r p <&7; do if ! "$bin_dir/merge_fix" -n "$p"; then - linux-next-notify "merge fix failed for $tree" - bash -i || exit + fix_up "merge fix failed for $tree" fi 7<&- done 7<"../merge-fixes/$tree" fi @@ -134,21 +143,15 @@ for h in $heads; do repo="${build_host:+$build_host:}${build_dir}" if ! git push -f "$repo" master:refs/heads/next; then - echo git push failed 1>&2 - linux-next-notify "push failed for $tree" - bash -i || exit + fix_up "push failed for $tree" "git push failed" fi if [ -x "../pre-build/$tree" ] && ! "../pre-build/$tree"; then - echo Prebuild script failed 1>&2 - linux-next-notify "pre-build script failed for $tree" - bash -i || exit + fix_up "pre-build script failed for $tree" "Prebuild script failed" fi if ! "$bin_dir/do_build" "$tree"; then - echo Build failed 1>&2 - linux-next-notify "build failed for $tree" - bash -i || exit + fix_up "build failed for $tree" "Build failed" fi need_build=false -- 2.39.5