Skip to content

Commit 9e4bc7d

Browse files
Eric WongJunio C Hamano
authored andcommitted
rebase: cleanup rebasing with --merge
We no longer have to recommit each patch to remove the parent information we're rebasing since we're using the low-level merge strategies directly instead of git-merge. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 9a99c08 commit 9e4bc7d

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

git-rebase.sh

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,16 @@ continue_merge () {
5959

6060
if test -n "`git-diff-index HEAD`"
6161
then
62+
printf "Committed: %0${prec}d" $msgnum
6263
git-commit -C "`cat $dotest/current`"
6364
else
64-
echo "Previous merge succeeded automatically"
65+
printf "Already applied: %0${prec}d" $msgnum
6566
fi
67+
echo ' '`git-rev-list --pretty=oneline -1 HEAD | \
68+
sed 's/^[a-f0-9]\+ //'`
6669

6770
prev_head=`git-rev-parse HEAD^0`
68-
6971
# save the resulting commit so we can read-tree on it later
70-
echo "$prev_head" > "$dotest/cmt.$msgnum.result"
7172
echo "$prev_head" > "$dotest/prev_head"
7273

7374
# onto the next patch:
@@ -82,10 +83,7 @@ call_merge () {
8283
rv=$?
8384
case "$rv" in
8485
0)
85-
if test -n "`git-diff-index HEAD`"
86-
then
87-
git-commit -C "$cmt" || die "commit failed: $MRESOLVEMSG"
88-
fi
86+
return
8987
;;
9088
1)
9189
test -d "$GIT_DIR/rr-cache" && git-rerere
@@ -103,27 +101,6 @@ call_merge () {
103101
}
104102

105103
finish_rb_merge () {
106-
set -e
107-
108-
msgnum=1
109-
echo "Finalizing rebased commits..."
110-
git-reset --hard "`cat $dotest/onto`"
111-
end="`cat $dotest/end`"
112-
while test "$msgnum" -le "$end"
113-
do
114-
git-read-tree `cat "$dotest/cmt.$msgnum.result"`
115-
git-checkout-index -q -f -u -a
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))
126-
done
127104
rm -r "$dotest"
128105
echo "All done."
129106
}

0 commit comments

Comments
 (0)