From d4f9435ac47bd401f844aa4a52c3504e3009b253 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Thu, 3 Mar 2022 16:06:41 +0100 Subject: tweak markdown-add-pr-links.sh for idempotency --- release-info/markdown-add-pr-links.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'release-info') diff --git a/release-info/markdown-add-pr-links.sh b/release-info/markdown-add-pr-links.sh index 4b3a37a879..3955a40782 100644 --- a/release-info/markdown-add-pr-links.sh +++ b/release-info/markdown-add-pr-links.sh @@ -23,8 +23,15 @@ # It was only tested with GNU sed. Sorry! +# Note: we turn #1234 into #[1234](.../issues/1234), with the '#' +# outside the link. This gives the property that the script is +# idempotent, it can be run on its own output and keeps it +# unchanged. This makes it possible, for example, to run the script, +# then add yet more non-linkified content, and run the script again on +# the whole file. + GITHUB=https://github.com/ocaml/ocaml sed "s,(Changes#\(.*\)),[Changes file for \\1]($GITHUB/blob/\\1/Changes),g" $1 \ -| sed "s,#\([0-9]\+\),[#\\1]($GITHUB/issues/\\1),g" \ +| sed "s,#\([0-9]\+\),#[\\1]($GITHUB/issues/\\1),g" \ | sed "s/^*/* [*breaking change*]/g" -- cgit v1.2.1