@matheusbsbs / matheus-bagliano / commits / 4fb1a19d50
Fork 0

rebase -i -p: leave a --cc patch when a merge could not be redone

The result is easier to review this way, and the merge resolution has to be done inside the work tree, not by adjusting "the patch" anyway.

Johannes Schindelin committed Dec 22, 2008 at 22:16 UTC 4fb1a19d502f4a2ca47bfb75cce605f3447819e6
2 files changed +13 -3
git-rebase--interactive.sh
+12 -3
@@ -115,9 +115,18 @@ mark_action_done () {
115 }
116
117 make_patch () {
118 - parent_sha1=$(git rev-parse --verify "$1"^) ||
119 - die "Cannot get patch for $1^"
120 - git diff-tree -p "$parent_sha1".."$1" > "$DOTEST"/patch
118 + sha1_and_parents="$(git rev-list --parents -1 "$1")"
119 + case "$sha1_and_parents" in
120 + ?*' '?*' '?*)
121 + git diff --cc $sha1_and_parents
122 + ;;
123 + ?*' '?*)
124 + git diff-tree -p "$1^!"
125 + ;;
126 + *)
127 + echo "Root commit"
128 + ;;
129 + esac > "$DOTEST"/patch
130 test -f "$DOTEST"/message ||
131 git cat-file commit "$1" | sed "1,/^$/d" > "$DOTEST"/message
132 test -f "$DOTEST"/author-script ||
t/t3409-rebase-preserve-merges.sh
+1
@@ -83,6 +83,7 @@ test_expect_success '--continue works after a conflict' '
83 test 2 = $(git ls-files B | wc -l) &&
84 echo Resolved again > B &&
85 test_must_fail git rebase --continue &&
86 + grep "^@@@ " .git/rebase-merge/patch &&
87 git add B &&
88 git rebase --continue &&
89 test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&