From 8ad1065e580c03035c583e2d237cc5b76f90cee4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 30 Dec 2007 12:37:59 -0800 Subject: [PATCH] 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 --- git-rebase--interactive.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 090c3e5143..d0d83c35e6 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -215,15 +215,17 @@ make_squash_message () { COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \ < "$SQUASH_MSG" | tail -n 1)+1)) echo "# This is a combination of $COUNT commits." - sed -n "2,\$p" < "$SQUASH_MSG" + sed -e 1d -e '2,/^./{ + /^$/d + }' <"$SQUASH_MSG" else COUNT=2 echo "# This is a combination of two commits." echo "# The first commit's message is:" echo git cat-file commit HEAD | sed -e '1,/^$/d' - echo fi + echo echo "# This is the $(nth_string $COUNT) commit message:" echo git cat-file commit $1 | sed -e '1,/^$/d' -- 2.11.4.GIT