git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Force new line at end of commit message

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 29, 2007, 13:31 UTC
Message-ID
<Pine.LNX.4.64.0712291426500.14355@wbgn129.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7v4pe5nt8m.fsf@gitster.siamese.dyndns.org>
Hi,
On Wed, 26 Dec 2007, Junio C Hamano wrote:
Show 12 quoted lines
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 090c3e5..d0d83c3 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"

If I read this correctly (haven't tested), then _all_ empty lines are removed from the SQUASH_MSG, right? This is not what I want.

I had something like this in mind, rather:
		-e '\$s/\n*$/\n/'

This is completely untested, but should show the idea. However, the same must go into this clause:

Show 6 quoted lines
>  	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'

Unfortunately, I am unable to provide a proper patch with proper testing right now, since my family threatens me with physical violence, should I not leave the keyboard right n.. OUCH!

Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 28 in “git rebase -i / git-gui bug”
  1. Bernt HansenDec 20, 2007
  2. Bernt HansenDec 20, 2007
  3. Reallow git-rebase --interactive --continue if commit is unnecessaryShawn O. Pearce, Dec 20, 2007
  4. Junio C HamanoDec 20, 2007
  5. Shawn O. PearceDec 20, 2007
  6. Junio C HamanoDec 20, 2007
  7. Junio C HamanoDec 26, 2007
  8. Johannes SchindelinDec 29, 2007
  9. Matthieu MoyDec 20, 2007
  10. Force new line at end of commit messageBernt Hansen, Dec 24, 2007
  11. Johannes SchindelinDec 24, 2007
  12. Shawn O. PearceDec 25, 2007
  13. Junio C HamanoDec 25, 2007
  14. Bernt HansenDec 26, 2007
  15. Shawn O. PearceDec 27, 2007
  16. git-gui: Make commit log messages end with a newlineBernt Hansen, Dec 28, 2007
  17. Junio C HamanoDec 26, 2007
  18. Johannes SchindelinDec 29, 2007
  19. Junio C HamanoDec 30, 2007
  20. Johannes SchindelinDec 30, 2007
  21. Junio C HamanoDec 30, 2007
  22. Johannes SchindelinDec 30, 2007
  23. Junio C HamanoDec 30, 2007
  24. しらいしななこDec 30, 2007
  25. Junio C HamanoDec 30, 2007
  26. Junio C HamanoDec 30, 2007
  27. Johannes SchindelinDec 30, 2007
  28. Shawn O. PearceDec 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.