Why doesn't git rebase --interactive --preserve-merges continue past known conflicts?
When I run "git rebase --interactive --preserve-merges" on a sequence of commits, edit an earlier commit, then run "git rebase --continue", the rebase operation always stops on a merge commit with a known conflict (in the rr-cache) instead of resolving it and continuing.
As long as I'm not rearranging commits, I expect git-rebase to resolve the known merge commit conflict and continue. Why does it always stop?
I've attached a simple test case that demonstrates this behavior.
Dave
RFC PATCH 1/1 Why doesn't git rebase --interactive --preserve-merges continue past known conflicts?
Quoted 7 lines · David Kilzer
When I run "git rebase --interactive --preserve-merges" on a sequence of commits, edit an earlier commit, then run "git rebase --continue", the rebase operation always stops on a merge commit with a known conflict (in the rr-cache) instead of resolving it and continuing.
As long as I'm not rearranging commits, I expect git-rebase to resolve the known merge commit conflict and continue. Why does it always stop?
Here's a very rough patch that fixes my original test case so that an interactive rebase won't stop when git-rerere knows how to resolve all conflicts during a merge.
However, if there are any changes to a non-conflicted file during the original merge commit, they will be lost when rebasing, even with --preserve-merges. Note that this occurs even without this patch applied. You must compare the current commit with original being rebased to make sure they're not lost.
Why doesn't an interactive rebase serialize to disk all of the changes in a merge commit like it does for non-merge commits?
Dave
--- git-rebase--interactive.sh | 11 ++++- t/t3404-rebase-interactive-preserve-merges.sh | 64 +++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100755 t/t3404-rebase-interactive-preserve-merges.sh
git-rebase--interactive.sh +9 -2
@@ -338,11 +338,18 @@ pick_one_preserving_merges () { msg="$(commit_message $sha1)" # No point in merging the first parent, that's HEAD new_parents=${new_parents# $first_parent} + # If rerere is enabled, pass the --rerere-autoupdate flag + test "$(git config --bool rerere.enabled)" = "true" && + rerere_autoupdate=--rerere-autoupdate || rerere_autoupdate= if ! do_with_author output \ - git merge $STRATEGY -m "$msg" $new_parents + git merge $STRATEGY $rerere_autoupdate -m "$msg" $new_parents then printf "%s\n" "$msg" > "$GIT_DIR"/MERGE_MSG - die_with_patch $sha1 "Error redoing merge $sha1" + # Commit the result if rerere resolved all the conflicts. + git update-index -q --refresh && + printf "Resolved all conflicts using rerere.\n" && + do_with_author git commit --no-verify -F "$GIT_DIR"/MERGE_MSG || + die_with_patch $sha1 "Error redoing merge $sha1" fi echo "$sha1 $(git rev-parse HEAD^0)" >> "$REWRITTEN_LIST" ;;
t/t3404-rebase-interactive-preserve-merges.sh new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
1.7.2.1.103.g48452