Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)."
Expand Down
21 changes: 3 additions & 18 deletions update-pr-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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]}"
Expand Down
Loading