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
7 changes: 7 additions & 0 deletions .github/workflows/codex-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3797,6 +3797,13 @@ continue_rerere_resolution () {
while rebase_in_progress "$worktree" &&
test -z "$(git -C "$worktree" -c core.fsmonitor=false ls-files -u)"
do
# A failed octopus can leave a clean index without a resolution.
# Continuing in that state would skip the failed merge.
if git -C "$worktree" diff --cached --quiet &&
! git -C "$worktree" rev-parse --verify -q MERGE_HEAD >/dev/null
then
return 1
fi
before=$(git -C "$worktree" rev-parse --verify REBASE_HEAD \
2>/dev/null || :)
if ! GIT_COMMITTER_NAME=$bot_name \
Expand Down
49 changes: 49 additions & 0 deletions t/t9905-codex-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4513,6 +4513,55 @@ test_expect_success 'codex rerere history can resolve a topic rebase' '
)
'

test_expect_success 'rerere continuation stops at an aborted octopus merge' '
test_create_repo aborted-octopus &&
(
cd aborted-octopus &&
test_commit base shared &&
git switch -c side-a master &&
test_commit side-a shared &&
git switch -c side-b master &&
test_commit side-b side-file &&
git switch -c topic master &&
test_commit topic shared &&
write resolved shared &&
write side-b side-file &&
git add shared side-file &&
merge=$(git commit-tree "$(git write-tree)" \
-p HEAD -p side-a -p side-b -m "resolved octopus") &&
git reset --hard "$merge" &&
test_commit after-merge after-file &&
git switch -c onto master &&
test_commit onto onto-file &&
git switch topic &&
test_must_fail git -c rerere.enabled=true \
-c rerere.autoupdate=true \
rebase --rebase-merges --onto onto master \
>rebase.out 2>rebase.err &&
test "$merge" = "$(git rev-parse REBASE_HEAD)" &&
test -z "$(git ls-files -u)" &&
git diff --cached --exit-code &&
test_must_fail git rev-parse --verify -q MERGE_HEAD &&
git rev-parse HEAD >before &&
sed -n "/^rebase_in_progress () {$/,/^}/p;
/^continue_rerere_resolution () {$/,/^}/p" \
"$codex_branch" >../rerere-functions &&
test_expect_code 1 sh -c "
. ../rerere-functions
replay_rerere=true
bot_name=\"$codex_bot_name\"
bot_email=\"$codex_bot_email\"
continue_rerere_resolution .
" >continue.out 2>continue.err &&
git rev-parse HEAD >after &&
test_cmp before after &&
test "$merge" = "$(git rev-parse REBASE_HEAD)" &&
test_path_is_dir .git/rebase-merge &&
test_path_is_missing after-file &&
git rebase --abort
)
'

test_expect_success 'rewrite preserves a merge in an enrolled stable topic' '
git init --bare private.git &&
test_create_repo private-source &&
Expand Down