Skip to content

Commit

Permalink
Prevent accidental removal of headers when amending a commit (ros-inf…
Browse files Browse the repository at this point in the history
…rastructure#228)

superflore currently generates commit messages that contain lines
starting with the markdown header indicator "#". However, commit message
lines that start with "#" are considered comments when amending a commit
and are removed unless the user remembers to quote them. Prevent these
lines from accidentally being removed by using the alternate form of
header indication: a line starting with "="-s or "-"-s underneath the
header text.
  • Loading branch information
herb-kuta-lge committed Nov 15, 2019
1 parent 9e525c7 commit 4ff4bf8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions superflore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,18 @@ def gen_delta_msg(total_changes, markup='*'):
"""Return string of changes for the PR message."""
delta = ''
is_single_distro = len(total_changes) == 1
distro_header = '#'
distro_header = '='
if not is_single_distro:
delta += "# Changes:\n"
distro_header *= 2
delta += "Changes:\n"
delta += "========\n"
distro_header = '-'
for distro in sorted(total_changes):
if not total_changes[distro]:
continue
delta += "{} {} Changes:\n".format(distro_header, distro.title())
heading = "{} Changes:\n".format(distro.title())
delta += heading
delta += distro_header * (len(heading) - 1)
delta += "\n"
for d in sorted(total_changes[distro]):
delta += '* {1}{0}{1}\n'.format(d, markup)
delta += "\n"
Expand Down

0 comments on commit 4ff4bf8

Please # to comment.