@matheusbsbs / matheus-bagliano / commits / 9a99c087da
Fork 0

rebase: allow --merge option to handle patches merged upstream

Enhance t3401-rebase-partial to test with --merge as well as the standard am -3 strategy. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Eric Wong committed Jun 24, 2006 at 18:29 UTC 9a99c087da7cd6b4a41c19df3053542f645315c5
2 files changed +23 -5
git-rebase.sh
+11 -4
@@ -82,7 +82,10 @@ call_merge () {
82 rv=$?
83 case "$rv" in
84 0)
85 - git-commit -C "$cmt" || die "commit failed: $MRESOLVEMSG"
85 + if test -n "`git-diff-index HEAD`"
86 + then
87 + git-commit -C "$cmt" || die "commit failed: $MRESOLVEMSG"
88 + fi
89 ;;
90 1)
91 test -d "$GIT_DIR/rr-cache" && git-rerere
@@ -110,9 +113,13 @@ finish_rb_merge () {
113 do
114 git-read-tree `cat "$dotest/cmt.$msgnum.result"`
115 git-checkout-index -q -f -u -a
113 - git-commit -C "`cat $dotest/cmt.$msgnum`"
114 -
115 - printf "Committed %0${prec}d" $msgnum
116 + if test -n "`git-diff-index HEAD`"
117 + then
118 + git-commit -C "`cat $dotest/cmt.$msgnum`"
119 + printf "Committed %0${prec}d" $msgnum
120 + else
121 + printf "Already applied: %0${prec}d" $msgnum
122 + fi
123 echo ' '`git-rev-list --pretty=oneline -1 HEAD | \
124 sed 's/^[a-f0-9]\+ //'`
125 msgnum=$(($msgnum + 1))
t/t3401-rebase-partial.sh
+12 -1
@@ -37,7 +37,9 @@ test_expect_success \
37 test_expect_success \
38 'pick top patch from topic branch into master' \
39 'git-cherry-pick my-topic-branch^0 &&
40 - git-checkout -f my-topic-branch
40 + git-checkout -f my-topic-branch &&
41 + git-branch master-merge master &&
42 + git-branch my-topic-branch-merge my-topic-branch
43 '
44
45 test_debug \
@@ -50,4 +52,13 @@ test_expect_success \
52 'rebase topic branch against new master and check git-am did not get halted' \
53 'git-rebase master && test ! -d .dotest'
54
55 +if test -z "$no_python"
56 +then
57 + test_expect_success \
58 + 'rebase --merge topic branch that was partially merged upstream' \
59 + 'git-checkout -f my-topic-branch-merge &&
60 + git-rebase --merge master-merge &&
61 + test ! -d .git/.dotest-merge'
62 +fi
63 +
64 test_done