diff options
author | Clark Boylan <clark.boylan@gmail.com> | 2018-03-20 16:12:20 -0700 |
---|---|---|
committer | Clark Boylan <clark.boylan@gmail.com> | 2018-03-20 16:12:20 -0700 |
commit | 183b445c0f8eb84568df6e07cf34dcc3e1935cec (patch) | |
tree | a991609ddc52f648170ce8c4c3e8b925b3c41530 | |
parent | 56c27c21d170c1d78ad54f8825a83d469734e9bb (diff) | |
download | pbr-183b445c0f8eb84568df6e07cf34dcc3e1935cec.tar.gz |
Better Sem-Ver header handling
This makes Sem-Ver header handling more reliable by ignoring any
potential user configured git log output format. Instead PBR supplies
its own format string that will output the commit message bodies in
their entirety without wrapping and other whitespace formatting done for
humans.
Change-Id: I957a8c182585119534b4e02c34e7140a3e07d1d6
Related-Bug: 1738685
Fixes-Bug: 1704625
-rw-r--r-- | pbr/packaging.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py index 38b4982..1ff28da 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -622,10 +622,14 @@ def _get_increment_kwargs(git_dir, tag): version_spec = tag + "..HEAD" else: version_spec = "HEAD" - changelog = git._run_git_command(['log', version_spec], git_dir) - header_len = len(' sem-ver:') + # Get the raw body of the commit messages so that we don't have to + # parse out any formatting whitespace and to avoid user settings on + # git log output affecting out ability to have working sem ver headers. + changelog = git._run_git_command(['log', '--pretty=%B', version_spec], + git_dir) + header_len = len('sem-ver:') commands = [line[header_len:].strip() for line in changelog.split('\n') - if line.lower().startswith(' sem-ver:')] + if line.lower().startswith('sem-ver:')] symbols = set() for command in commands: symbols.update([symbol.strip() for symbol in command.split(',')]) |