From: Nathan Cutler Date: Mon, 10 Feb 2020 12:02:18 +0000 (+0100) Subject: ceph-backport.sh/PR quoting: eliminate unwanted newlines X-Git-Tag: v15.1.1~438^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e78b3fdcaea6f28c66cd66b67fca2080d8cdda3;p=ceph.git ceph-backport.sh/PR quoting: eliminate unwanted newlines Sometimes the PR body has multiple newlines which do not need to be quoted. Also, the way we interact with the GitHub API, we were getting some newline duplication. This patch reduces all clumps of multiple blank lines down to a single blank line. Signed-off-by: Nathan Cutler --- diff --git a/src/script/ceph-backport.sh b/src/script/ceph-backport.sh index 5a34b13b6b11..fb8900fb0185 100755 --- a/src/script/ceph-backport.sh +++ b/src/script/ceph-backport.sh @@ -320,6 +320,29 @@ function clear_line { log overwrite " \r" } +function clip_pr_body { + local pr_body="$*" + local clipped="" + local last_line_was_blank="" + local line="" + local pr_json_tempfile=$(mktemp) + echo "$pr_body" | sed -n '/