diff options
-rw-r--r-- | gbp/dch.py | 2 | ||||
-rw-r--r-- | gbp/git/repository.py | 20 | ||||
-rw-r--r-- | tests/test_GitRepository.py | 2 |
3 files changed, 13 insertions, 11 deletions
@@ -106,7 +106,7 @@ def format_changelog_entry(commit_info, options, last_commit=False): GitRepository.get_commit_info()). If last_commit is not False, then this entry is the last one in the series.""" entry = [commit_info['subject']] - body = commit_info['body'] + body = commit_info['body'].splitlines() commitid = commit_info['id'] (git_dch_cmds, body) = extract_git_dch_cmds(body, options) diff --git a/gbp/git/repository.py b/gbp/git/repository.py index c4ac66c..2a8cdd8 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1192,17 +1192,19 @@ class GitRepository(object): @return: the commit's including id, author, email, subject and body @rtype: dict """ - out, ret = self._git_getoutput('log', - ['--pretty=format:%an%n%ae%n%s%n%b%n', - '-n1', commit]) - if ret: - raise GitRepositoryError("Unable to retrieve log entry for %s" + args = GitArgs('--pretty=format:%an%x00%ae%x00%s%x00%b%x00', + '-z', '--quiet', commit) + out, err, ret = self._git_inout('show', args.args) + if ret > 1: + raise GitRepositoryError("Unable to retrieve commit info for %s" % commit) + + fields = out.split('\x00') return {'id' : commit, - 'author' : out[0].strip(), - 'email' : out[1].strip(), - 'subject' : out[2].rstrip(), - 'body' : [line.rstrip() for line in out[3:]]} + 'author' : fields[0].strip(), + 'email' : fields[1].strip(), + 'subject' : fields[2], + 'body' : fields[3]} #{ Patches diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py index 8461904..78c38b4 100644 --- a/tests/test_GitRepository.py +++ b/tests/test_GitRepository.py @@ -354,7 +354,7 @@ def test_get_commit_info(): >>> info['id'] 'HEAD' >>> info['body'] - [''] + '' >>> info['subject'] 'foo' >>> '@' in info['email'] |