git/hooks: only use first line as project description

Hi all,

This is something I've seen for ages and thought should be fixed (either by
this patch and/or another which supports multi-line description files
properly).

I have an alternate version of this patch which side-steps the issue by adding
the X-Project header last, so if it's multiple lines it won't screw up other
headers.  I think this is the proper fix though.

If multi-line description files are really something which are desired, then a
commit on top of this change could add support for reading the remaining lines
from the description file and add them to the message body.

 roles/git/hooks/files/git.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
This commit is contained in:
Todd Zullinger 2018-02-20 20:29:25 -05:00 committed by Kevin Fenzi
parent 25d9274b52
commit 4a3ef1013c

View file

@ -202,7 +202,8 @@ def get_project_description():
description = os.path.join(git_dir, 'description')
if os.path.exists(description):
try:
projectdesc = open(description).read().strip()
with open(description, 'r') as f:
projectdesc = f.readline().strip()
except:
pass
if projectdesc.startswith('Unnamed repository;'):