Extra newline added to commit messages -- why?

1 view
Skip to first unread message

Ori Avtalion

unread,
Apr 15, 2010, 6:16:17 PM4/15/10
to us...@subversion.apache.org
Hi,

After looking at logs for a project, I notice some commits have an empty
line between the commit text and the "------" line, and some don't.

After asking on #svn and doing some tests, I realized that the commits I
saw without the extra newline were either made by "commit -m", git-svn,
or by removing the helper "--This line, and those below, will be
ignored--" text from the commit message file and telling the editor to
not add a newline to the end of a file. (e.g. Can be done using an
autocmd in vim)

Why is that newline added in the first place?

Shouldn't Subversion maintain the appearance of the commit message as it
is in the temp commit message file and ignore the newline between the
message itself and the "--This line" text?

As another example of why I find this illogical, these two processes
should produce the same commit log message, but they don't:

This doesn't add a newline at the end
1) $ svn commit -m "Fixed something"

This does:
2) $ svn commit # then edit:
Fixed something
--This line, and those below, will be ignored--

M a
EOF

What do you think?

-Ori

Ryan Schmidt

unread,
Apr 15, 2010, 6:56:07 PM4/15/10
to Ori Avtalion, us...@subversion.apache.org

On Apr 15, 2010, at 17:16, Ori Avtalion wrote:

> What do you think?

I think you should use log-police.py to make it a non-issue. This script ensures all log messages end with exactly one newline, regardless how many were there originally. You can set it up as a hook script to auto-correct new commits as they happen, and run it once over all existing commits to fix them up as well.

http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/log-police.py





--
Subscription settings: http://groups.google.com/group/subversion_users/subscribe?hl=en

Ori Avtalion

unread,
Apr 16, 2010, 7:18:53 AM4/16/10
to Ryan Schmidt, us...@subversion.apache.org
On 04/16/2010 01:56 AM, Ryan Schmidt wrote:
>
> I think you should use log-police.py to make it a non-issue. This script ensures all log messages end with exactly one newline, regardless how many were there originally. You can set it up as a hook script to auto-correct new commits as they happen, and run it once over all existing commits to fix them up as well.
>

I understand you can hack around such things with server hooks (if you
have access to the server), but shouldn't this inconsistency be
considered a (minor) bug that should be fixed?

Ulrich Eckhardt

unread,
Apr 19, 2010, 6:53:56 AM4/19/10
to us...@subversion.apache.org
On Friday 16 April 2010, Ori Avtalion wrote:
> [...] I realized that the commits I saw without the extra newline
> were either made by "commit -m", git-svn, or by removing the helper
> "--This line, and those below, will be ignored--" text from the
> commit message file and telling the editor to not add a newline to
> the end of a file. (e.g. Can be done using an autocmd in vim)
>
> Why is that newline added in the first place?
>
> Shouldn't Subversion maintain the appearance of the commit message
> as it is in the temp commit message file and ignore the newline
> between the message itself and the "--This line" text?

IMHO, no. The newline is not the start of the "--This line.." but the end of
the previous one, i.e. part of the previous line.

> As another example of why I find this illogical, these two processes
> should produce the same commit log message, but they don't:
>
> This doesn't add a newline at the end
> 1) $ svn commit -m "Fixed something"
>
> This does:
> 2) $ svn commit # then edit:
> Fixed something
> --This line, and those below, will be ignored--
>
> M a
> EOF

I would actually prefer the first variant to automatically add a newline at
the end unless already present, but that goes against the explicit request to
add a message without a newline. And no, these should not produce the same
log messages.

Uli

--
ML: http://subversion.tigris.org/mailing-list-guidelines.html
FAQ: http://subversion.tigris.org/faq.html
Docs: http://svnbook.red-bean.com/

Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************
Reply all
Reply to author
Forward
0 new messages