make_squash_message () {
if test -f "$SQUASH_MSG"; then
- # We want to be careful about matching only the commit
- # message comment lines generated by this function.
- # "[snrt][tdh]" matches the nth_string endings.
- COUNT=$(($(sed -n "s/^# Th[^0-9]*\([1-9][0-9]*\)[snrt][tdh] commit message.*:/\1/p" \
- < "$SQUASH_MSG" | sed -ne '$p')+1))
+ COUNT=$(($(sed -n \
+ -e "1s/^# This is a combination of \(.*\) commits\./\1/p" \
+ -e "q" < "$SQUASH_MSG")+1))
echo "# This is a combination of $COUNT commits."
sed -e 1d -e '2,/^./{
/^$/d
echo
echo "# The $(nth_string $COUNT) commit message will be skipped:"
echo
- # Comment the lines of the commit message out using
- # "# " rather than "# " to make them less likely to
- # confuse the sed regexp above.
git cat-file commit $2 | sed -e '1,/^$/d' -e 's/^/# /'
;;
esac