Fix git-rebase -i to allow squashing of fast-forwardable commits
Without this change the commits will be left standalone, with duplicated commit message. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alex Riesen committed
Jul 13, 2007 at 00:30 UTC
793ad04198a79c14094bd1311a9c42f1293c6183
1 file changed
+3
-2
git-rebase--interactive.sh
+3
-2
@@ -84,6 +84,7 @@ pick_one () {
84
current_sha1=$(git rev-parse --verify HEAD)
85
if [ $current_sha1 = $parent_sha1 ]; then
86
git reset --hard $sha1
87
+ test "a$1" = a-n && git reset --soft $current_sha1
88
sha1=$(git rev-parse --short $sha1)
89
warn Fast forward to $sha1
90
else
@@ -193,14 +194,14 @@ do_next () {
194
die "Cannot 'squash' without a previous commit"
195
196
mark_action_done
196
- failed=f
197
- pick_one -n $sha1 || failed=t
197
MSG="$DOTEST"/message
198
echo "# This is a combination of two commits." > "$MSG"
199
echo "# The first commit's message is:" >> "$MSG"
200
echo >> "$MSG"
201
git cat-file commit HEAD | sed -e '1,/^$/d' >> "$MSG"
202
echo >> "$MSG"
203
+ failed=f
204
+ pick_one -n $sha1 || failed=t
205
echo "# And this is the 2nd commit message:" >> "$MSG"
206
echo >> "$MSG"
207
git cat-file commit $sha1 | sed -e '1,/^$/d' >> "$MSG"