diff --git a/tests/test_e2e.sh b/tests/test_e2e.sh index b510424..1da4439 100755 --- a/tests/test_e2e.sh +++ b/tests/test_e2e.sh @@ -291,7 +291,7 @@ assert_conflict_comment_merges() { expected+="git merge $conflict"$'\n' done expected=${expected%$'\n'} - actual=$(echo "$comment" | grep -E '^git merge' || true) + actual=$(echo "$comment" | grep -E '^git merge' | sed 's/ *#.*//' || true) if [[ "$actual" == "$expected" ]]; then echo >&2 "✅ Verification Passed: conflict comment lists expected merge command(s)." diff --git a/update-pr-stack.sh b/update-pr-stack.sh index 3676a9e..a2d8ca5 100755 --- a/update-pr-stack.sh +++ b/update-pr-stack.sh @@ -74,17 +74,6 @@ has_squash_commit() { && git merge-base --is-ancestor SQUASH_COMMIT "$BRANCH" } -format_branch_list_for_text() { - for ((i=1; i<=$#; i++)); do - case $i in - 1) format='`%s`';; - $#) format=', and `%s`';; - *) format=', `%s`';; - esac - printf "$format" "${!i}" - done -} - update_direct_target() { local BRANCH="$1" local BASE_BRANCH="$2" @@ -113,7 +102,7 @@ update_direct_target() { # included in the merged branch — otherwise the first merge covers it. if ! git merge-base --is-ancestor SQUASH_COMMIT~ "origin/$MERGED_BRANCH"; then if ! log_cmd git merge --no-edit SQUASH_COMMIT~; then - CONFLICTS+=( "$(git rev-parse SQUASH_COMMIT~)" ) + CONFLICTS+=( "$(git rev-parse SQUASH_COMMIT~) # $TARGET_BRANCH just before $MERGED_BRANCH was merged" ) log_cmd git merge --abort fi fi @@ -135,15 +124,11 @@ update_direct_target() { { echo "### ⚠️ Automatic update blocked by merge conflicts" echo - echo -n "I tried to merge " - format_branch_list_for_text "${CONFLICTS[@]}" - echo " into this branch while updating the pull request stack and hit conflicts." - echo - echo "#### How to resolve" + echo "Resolve them like this:" echo '```bash' echo "git fetch origin" echo "git switch $BRANCH" - echo "git pull origin $BRANCH" + echo "git merge --ff-only origin/$BRANCH" for i in "${!CONFLICTS[@]}"; do echo "git merge ${CONFLICTS[$i]}"