findmissing: git_interface: Clean up whitespace after removing Change-IDs

If we clean up whitespaces at the end of a commit message before
removing Change-IDs, and a removed Change-Id was at the end of the
commit message, a newline at the end of the commit message is again
introduced. Since the subsequently added Change-Id also adds a newline
ahead of it, we end up with an empty line before the Change-Id.
To avoid this, remove trailing whitespaces in the commit message
after removing Change-Ids.

Also, don't add a newline after the Change-Id; git already adds one,
and we just end up with a stray empty line at the end of the commit
message if we provide one ourselves.

BUG=None
TEST=Observe commit message formatting in CLs created by the script

Change-Id: Iea5a7cf1e8ac1094f356195065eb7f540bc09795
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2317528
Commit-Queue: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
1 file changed