From 4a3ef1013c04752f536fa0982887ca2851317363 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Tue, 20 Feb 2018 20:29:25 -0500 Subject: [PATCH] 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(-) --- roles/git/hooks/files/git.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/git/hooks/files/git.py b/roles/git/hooks/files/git.py index 72adff1f7c..586fbffd2b 100644 --- a/roles/git/hooks/files/git.py +++ b/roles/git/hooks/files/git.py @@ -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;'):