git-rebase -i behaves better on commits with incomplete messages
The commit message template when squashing multiple commits is prepared by concatenating the messages of existing commits together. If the messages from some of them end with incomplete lines, this would result in a suboptimal message template. Make sure that we add a terminating LF after each commit message. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Dec 30, 2007 at 12:37 UTC
8ad1065e580c03035c583e2d237cc5b76f90cee4
1 file changed
+4
-2
git-rebase--interactive.sh
+4
-2
@@ -215,15 +215,17 @@ make_squash_message () {
215
COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
216
< "$SQUASH_MSG" | tail -n 1)+1))
217
echo "# This is a combination of $COUNT commits."
218
- sed -n "2,\$p" < "$SQUASH_MSG"
218
+ sed -e 1d -e '2,/^./{
219
+ /^$/d
220
+ }' <"$SQUASH_MSG"
221
else
222
COUNT=2
223
echo "# This is a combination of two commits."
224
echo "# The first commit's message is:"
225
echo
226
git cat-file commit HEAD | sed -e '1,/^$/d'
225
- echo
227
fi
228
+ echo
229
echo "# This is the $(nth_string $COUNT) commit message:"
230
echo
231
git cat-file commit $1 | sed -e '1,/^$/d'