{"thread":{"id":"55948","subject":"[PATCH 1/4] sideband: don't lose clear-to-eol at packet boundary","startedAt":"2021-06-17T03:17:35Z","lastAt":"2021-06-17T03:17:48Z","messageCount":4,"participants":["Jiang Xin"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"427655","messageId":"20210617031727.81105-1-zhiyou.jx@alibaba-inc.com","threadId":"55948","inReplyTo":null,"subject":"[PATCH 1/4] sideband: don't lose clear-to-eol at packet boundary","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2021-06-17T03:17:24Z","receivedAt":"2021-06-17T03:17:35Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"When \"demultiplex_sideband()\" sees a nonempty message ending with CR or\nLF on the sideband #2, it adds \"suffix\" string to clear to the end of\nthe current line, which helps when relaying a progress display whose\nrecords are terminated with CRs.  But if it sees a single LF, no\nclear-to-end suffix should be appended, because this single LF is used\nto end the progress display by moving to the next line, and the final\nprogress display above should be preserved.\n\nHowever, the code forgot that depending on the length of the payload\nline, such a CR may fall exactly at the packet boundary and the\nnumber of bytes before the CR from the beginning of the packet could\nbe zero.  In such a case, the message that was terminated by the CR\nwere leftover in the \"scratch\" buffer in the previous call to the\nfunction and we still need to clear to the end of the current line.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nHelped-by: Nicolas Pitre <nico@fluxnic.net>\nSigned-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>\n---\n sideband.c | 23 +++++++++++++++++++++++\n 1 file changed, 23 insertions(+)\n\ndiff --git a/sideband.c b/sideband.c\nindex 6f9e026732..85bddfdcd4 100644\n--- a/sideband.c\n+++ b/sideband.c\n@@ -183,8 +183,31 @@ int demultiplex_sideband(const char *me, int status,\n \t\twhile ((brk = strpbrk(b, \"\\n\\r\"))) {\n \t\t\tint linelen = brk - b;\n \n+\t\t\t/*\n+\t\t\t * For message accross packet boundary, there would have\n+\t\t\t * a nonempty \"scratch\" buffer from last call of this\n+\t\t\t * function, and there may have a leading CR/LF in \"buf\".\n+\t\t\t * For this case we should add a clear-to-eol suffix to\n+\t\t\t * clean leftover letters we previously have written on\n+\t\t\t * the same line.\n+\t\t\t */\n+\t\t\tif (scratch->len && !linelen)\n+\t\t\t\tstrbuf_addstr(scratch, suffix);\n+\n \t\t\tif (!scratch->len)\n \t\t\t\tstrbuf_addstr(scratch, DISPLAY_PREFIX);\n+\n+\t\t\t/*\n+\t\t\t * A use case that we should not add clear-to-eol suffix\n+\t\t\t * to empty lines:\n+\t\t\t *\n+\t\t\t * For progress reporting we may receive a bunch of\n+\t\t\t * percentage updates followed by '\\r' to remain on the\n+\t\t\t * same line, and at the end receive a single '\\n' to\n+\t\t\t * move to the next line. We should preserve the final\n+\t\t\t * status report line by not appending clear-to-eol\n+\t\t\t * suffix to this single line break.\n+\t\t\t */\n \t\t\tif (linelen > 0) {\n \t\t\t\tmaybe_colorize_sideband(scratch, b, linelen);\n \t\t\t\tstrbuf_addstr(scratch, suffix);\n-- \n2.32.0.rc0.27.g7b1e85181b\n\n"},{"id":"427657","messageId":"20210617031727.81105-2-zhiyou.jx@alibaba-inc.com","threadId":"55948","inReplyTo":"20210617031727.81105-1-zhiyou.jx@alibaba-inc.com","subject":"[PATCH 2/4] test: compare raw output, not mangle tabs and spaces","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2021-06-17T03:17:25Z","receivedAt":"2021-06-17T03:17:41Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Before comparing with the expect file, we used to call function\n\"make_user_friendly_and_stable_output\" to filter out trailing spaces in\noutput.  Ævar recommends using pattern \"s/Z$//\" to prepare expect file,\nand then compare it with raw output.\n\nSince we have fixed the issue of occasionally missing the clear-to-eol\nsuffix when displaying sideband #2 messages, it is safe and stable to\ntest against raw output.\n\nSuggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nSigned-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>\n---\n t/t5411/common-functions.sh                   |   9 +-\n t/t5411/test-0000-standard-git-push.sh        |  82 +++----\n .../test-0001-standard-git-push--porcelain.sh |  90 ++++----\n ...st-0003-pre-receive-declined--porcelain.sh |   8 +-\n t/t5411/test-0011-no-hook-error.sh            |  40 ++--\n t/t5411/test-0012-no-hook-error--porcelain.sh |  42 ++--\n t/t5411/test-0013-bad-protocol.sh             |  62 +++---\n t/t5411/test-0014-bad-protocol--porcelain.sh  |  80 +++----\n t/t5411/test-0020-report-ng.sh                |  32 +--\n t/t5411/test-0021-report-ng--porcelain.sh     |  36 ++--\n t/t5411/test-0022-report-unexpect-ref.sh      |  26 +--\n ...est-0023-report-unexpect-ref--porcelain.sh |  28 +--\n t/t5411/test-0024-report-unknown-ref.sh       |  18 +-\n ...test-0025-report-unknown-ref--porcelain.sh |  20 +-\n t/t5411/test-0026-push-options.sh             |  58 ++---\n t/t5411/test-0027-push-options--porcelain.sh  |  62 +++---\n t/t5411/test-0030-report-ok.sh                |  20 +-\n t/t5411/test-0031-report-ok--porcelain.sh     |  22 +-\n t/t5411/test-0032-report-with-options.sh      | 186 ++++++++--------\n ...est-0033-report-with-options--porcelain.sh | 200 +++++++++---------\n t/t5411/test-0034-report-ft.sh                |  22 +-\n t/t5411/test-0035-report-ft--porcelain.sh     |  24 +--\n ...t-0036-report-multi-rewrite-for-one-ref.sh | 132 ++++++------\n ...rt-multi-rewrite-for-one-ref--porcelain.sh | 138 ++++++------\n t/t5411/test-0038-report-mixed-refs.sh        |  74 +++----\n .../test-0039-report-mixed-refs--porcelain.sh |  76 +++----\n t/t5411/test-0040-process-all-refs.sh         |  80 +++----\n .../test-0041-process-all-refs--porcelain.sh  |  82 +++----\n ...t-0050-proc-receive-refs-with-modifiers.sh |  90 ++++----\n t/t5548-push-porcelain.sh                     |  54 ++---\n t/t6020-bundle-misc.sh                        |  45 ++--\n 31 files changed, 972 insertions(+), 966 deletions(-)\n\ndiff --git a/t/t5411/common-functions.sh b/t/t5411/common-functions.sh\nindex 6694858e18..6c347b4caa 100644\n--- a/t/t5411/common-functions.sh\n+++ b/t/t5411/common-functions.sh\n@@ -33,17 +33,14 @@ create_commits_in () {\n \n # Format the output of git-push, git-show-ref and other commands to make a\n # user-friendly and stable text.  We can easily prepare the expect text\n-# without having to worry about future changes of the commit ID and spaces\n+# without having to worry about changes of the commit ID (full or abbrev.)\n # of the output.  Single quotes are replaced with double quotes, because\n # it is boring to prepare unquoted single quotes in expect text.  We also\n # remove some locale error messages. The emitted human-readable errors are\n # redundant to the more machine-readable output the tests already assert.\n make_user_friendly_and_stable_output () {\n \tsed \\\n-\t\t-e \"s/  *\\$//\" \\\n-\t\t-e \"s/  */ /g\" \\\n \t\t-e \"s/'/\\\"/g\" \\\n-\t\t-e \"s/\t/    /g\" \\\n \t\t-e \"s/$A/<COMMIT-A>/g\" \\\n \t\t-e \"s/$B/<COMMIT-B>/g\" \\\n \t\t-e \"s/$TAG/<TAG-v123>/g\" \\\n@@ -59,6 +56,10 @@ filter_out_user_friendly_and_stable_output () {\n \t\tsed -n ${1+\"$@\"}\n }\n \n+format_and_save_expect () {\n+\tsed -e 's/^> //' -e 's/Z$//' >expect\n+}\n+\n test_cmp_refs () {\n \tindir=\n \tif test \"$1\" = \"-C\"\ndiff --git a/t/t5411/test-0000-standard-git-push.sh b/t/t5411/test-0000-standard-git-push.sh\nindex e1e0175c12..d8aafc235c 100644\n--- a/t/t5411/test-0000-standard-git-push.sh\n+++ b/t/t5411/test-0000-standard-git-push.sh\n@@ -7,16 +7,16 @@ test_expect_success \"git-push ($PROTOCOL)\" '\n \t\tHEAD:refs/heads/next \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> <COMMIT-B> -> main\n-\t * [new branch] HEAD -> next\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  <COMMIT-B> -> main\n+\t>  * [new branch]      HEAD -> next\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -38,10 +38,10 @@ test_expect_success \"git-push --atomic ($PROTOCOL)\" '\n \t\t-e \"/^To / { p; }\" \\\n \t\t-e \"/^ ! / { p; }\" \\\n \t\t<out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tTo <URL/of/upstream.git>\n-\t ! [rejected] main -> main (non-fast-forward)\n-\t ! [rejected] <COMMIT-B> -> next (atomic push failed)\n+\tformat_and_save_expect <<-EOF &&\n+\t> To <URL/of/upstream.git>\n+\t>  ! [rejected]        main -> main (non-fast-forward)\n+\t>  ! [rejected]        <COMMIT-B> -> next (atomic push failed)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -63,14 +63,14 @@ test_expect_success \"non-fast-forward git-push ($PROTOCOL)\" '\n \t\t$B:refs/heads/next \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> <COMMIT-B> -> next\n-\t ! [rejected] main -> main (non-fast-forward)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  <COMMIT-B> -> next\n+\t>  ! [rejected]        main -> main (non-fast-forward)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -92,25 +92,25 @@ test_expect_success \"git-push -f ($PROTOCOL)\" '\n \t\tHEAD:refs/heads/a/b/c \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next\n-\tremote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c\n-\tTo <URL/of/upstream.git>\n-\t + <OID-B>...<OID-A> main -> main (forced update)\n-\t - [deleted] next\n-\t * [new tag] v123 -> v123\n-\t * [new reference] main -> refs/review/main/topic\n-\t * [new branch] HEAD -> a/b/c\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next        Z\n+\t> remote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c        Z\n+\t> To <URL/of/upstream.git>\n+\t>  + <OID-B>...<OID-A> main -> main (forced update)\n+\t>  - [deleted]         next\n+\t>  * [new tag]         v123 -> v123\n+\t>  * [new reference]   main -> refs/review/main/topic\n+\t>  * [new branch]      HEAD -> a/b/c\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0001-standard-git-push--porcelain.sh b/t/t5411/test-0001-standard-git-push--porcelain.sh\nindex bcbda72341..2078d0a027 100644\n--- a/t/t5411/test-0001-standard-git-push--porcelain.sh\n+++ b/t/t5411/test-0001-standard-git-push--porcelain.sh\n@@ -7,17 +7,17 @@ test_expect_success \"git-push ($PROTOCOL/porcelain)\" '\n \t\tHEAD:refs/heads/next \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t     <COMMIT-B>:refs/heads/main    <OID-A>..<OID-B>\n-\t*    HEAD:refs/heads/next    [new branch]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \t<COMMIT-B>:refs/heads/main\t<OID-A>..<OID-B>\n+\t> *\tHEAD:refs/heads/next\t[new branch]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -38,12 +38,12 @@ test_expect_success \"git-push --atomic ($PROTOCOL/porcelain)\" '\n \tfilter_out_user_friendly_and_stable_output \\\n \t\t-e \"s/^# GETTEXT POISON #//\" \\\n \t\t-e \"/^To / { p; }\" \\\n-\t\t-e \"/^! / { p; }\" \\\n+\t\t-e \"/^!/ { p; }\" \\\n \t\t<out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tTo <URL/of/upstream.git>\n-\t!    refs/heads/main:refs/heads/main    [rejected] (non-fast-forward)\n-\t!    <COMMIT-B>:refs/heads/next    [rejected] (atomic push failed)\n+\tformat_and_save_expect <<-EOF &&\n+\t> To <URL/of/upstream.git>\n+\t> !\trefs/heads/main:refs/heads/main\t[rejected] (non-fast-forward)\n+\t> !\t<COMMIT-B>:refs/heads/next\t[rejected] (atomic push failed)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -65,15 +65,15 @@ test_expect_success \"non-fast-forward git-push ($PROTOCOL/porcelain)\" '\n \t\t$B:refs/heads/next \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t     <COMMIT-B>:refs/heads/next    <OID-A>..<OID-B>\n-\t!    refs/heads/main:refs/heads/main    [rejected] (non-fast-forward)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \t<COMMIT-B>:refs/heads/next\t<OID-A>..<OID-B>\n+\t> !\trefs/heads/main:refs/heads/main\t[rejected] (non-fast-forward)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -95,26 +95,26 @@ test_expect_success \"git-push -f ($PROTOCOL/porcelain)\" '\n \t\tHEAD:refs/heads/a/b/c \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next\n-\tremote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c\n-\tTo <URL/of/upstream.git>\n-\t+    refs/heads/main:refs/heads/main    <OID-B>...<OID-A> (forced update)\n-\t-    :refs/heads/next    [deleted]\n-\t*    refs/tags/v123:refs/tags/v123    [new tag]\n-\t*    refs/heads/main:refs/review/main/topic    [new reference]\n-\t*    HEAD:refs/heads/a/b/c    [new branch]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: pre-receive< <COMMIT-B> <ZERO-OID> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: post-receive< <COMMIT-B> <ZERO-OID> refs/heads/next        Z\n+\t> remote: post-receive< <ZERO-OID> <TAG-v123> refs/tags/v123        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c        Z\n+\t> To <URL/of/upstream.git>\n+\t> +\trefs/heads/main:refs/heads/main\t<OID-B>...<OID-A> (forced update)\n+\t> -\t:refs/heads/next\t[deleted]\n+\t> *\trefs/tags/v123:refs/tags/v123\t[new tag]\n+\t> *\trefs/heads/main:refs/review/main/topic\t[new reference]\n+\t> *\tHEAD:refs/heads/a/b/c\t[new branch]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0003-pre-receive-declined--porcelain.sh b/t/t5411/test-0003-pre-receive-declined--porcelain.sh\nindex e9c9db5d1f..2393b04ad9 100644\n--- a/t/t5411/test-0003-pre-receive-declined--porcelain.sh\n+++ b/t/t5411/test-0003-pre-receive-declined--porcelain.sh\n@@ -14,10 +14,10 @@ test_expect_success \"git-push is declined ($PROTOCOL/porcelain)\" '\n \t\tHEAD:refs/heads/next \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tTo <URL/of/upstream.git>\n-\t!    <COMMIT-B>:refs/heads/main    [remote rejected] (pre-receive hook declined)\n-\t!    HEAD:refs/heads/next    [remote rejected] (pre-receive hook declined)\n+\tformat_and_save_expect <<-EOF &&\n+\t> To <URL/of/upstream.git>\n+\t> !\t<COMMIT-B>:refs/heads/main\t[remote rejected] (pre-receive hook declined)\n+\t> !\tHEAD:refs/heads/next\t[remote rejected] (pre-receive hook declined)\n \tDone\n \tEOF\n \ttest_cmp expect actual &&\ndiff --git a/t/t5411/test-0011-no-hook-error.sh b/t/t5411/test-0011-no-hook-error.sh\nindex 3ef136e6ef..d35002b1f0 100644\n--- a/t/t5411/test-0011-no-hook-error.sh\n+++ b/t/t5411/test-0011-no-hook-error.sh\n@@ -7,16 +7,16 @@ test_expect_success \"proc-receive: no hook, fail to push special ref ($PROTOCOL)\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: error: cannot find hook \"proc-receive\"\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t * [new branch] HEAD -> next\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: error: cannot find hook \"proc-receive\"        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new branch]      HEAD -> next\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -41,16 +41,16 @@ test_expect_success \"proc-receive: no hook, all failed for atomic push ($PROTOCO\n \t\tHEAD:next \\\n \t\tHEAD:refs/for/main/topic >out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: error: cannot find hook \"proc-receive\"\n-\tTo <URL/of/upstream.git>\n-\t ! [remote rejected] <COMMIT-B> -> main (fail to run proc-receive hook)\n-\t ! [remote rejected] HEAD -> next (fail to run proc-receive hook)\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: error: cannot find hook \"proc-receive\"        Z\n+\t> To <URL/of/upstream.git>\n+\t>  ! [remote rejected] <COMMIT-B> -> main (fail to run proc-receive hook)\n+\t>  ! [remote rejected] HEAD -> next (fail to run proc-receive hook)\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0012-no-hook-error--porcelain.sh b/t/t5411/test-0012-no-hook-error--porcelain.sh\nindex 19f66fbd7d..04468b5018 100644\n--- a/t/t5411/test-0012-no-hook-error--porcelain.sh\n+++ b/t/t5411/test-0012-no-hook-error--porcelain.sh\n@@ -7,16 +7,16 @@ test_expect_success \"proc-receive: no hook, fail to push special ref ($PROTOCOL/\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: error: cannot find hook \"proc-receive\"\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/heads/next    [new branch]\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: error: cannot find hook \"proc-receive\"        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/heads/next\t[new branch]\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n \tDone\n \tEOF\n \ttest_cmp expect actual &&\n@@ -42,17 +42,17 @@ test_expect_success \"proc-receive: no hook, all failed for atomic push ($PROTOCO\n \t\tHEAD:next \\\n \t\tHEAD:refs/for/main/topic >out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: error: cannot find hook \"proc-receive\"\n-\tTo <URL/of/upstream.git>\n-\t!    <COMMIT-B>:refs/heads/main    [remote rejected] (fail to run proc-receive hook)\n-\t!    HEAD:refs/heads/next    [remote rejected] (fail to run proc-receive hook)\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: error: cannot find hook \"proc-receive\"        Z\n+\t> To <URL/of/upstream.git>\n+\t> !\t<COMMIT-B>:refs/heads/main\t[remote rejected] (fail to run proc-receive hook)\n+\t> !\tHEAD:refs/heads/next\t[remote rejected] (fail to run proc-receive hook)\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0013-bad-protocol.sh b/t/t5411/test-0013-bad-protocol.sh\nindex 095e613f6f..c08a00ded2 100644\n--- a/t/t5411/test-0013-bad-protocol.sh\n+++ b/t/t5411/test-0013-bad-protocol.sh\n@@ -29,8 +29,8 @@ test_expect_success \"proc-receive: bad protocol (unknown version, $PROTOCOL)\" '\n \t# message (\"remote: fatal: the remote end hung up unexpectedly\") which\n \t# is different from the remote HTTP server with different locale settings.\n \tgrep \"^remote: error:\" <actual >actual-error &&\n-\tcat >expect <<-EOF &&\n-\tremote: error: proc-receive version \"2\" is not supported\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: error: proc-receive version \"2\" is not supported        Z\n \tEOF\n \ttest_cmp expect actual-error &&\n \n@@ -208,17 +208,17 @@ test_expect_success \"proc-receive: bad protocol (no report, $PROTOCOL)\" '\n \t\tHEAD:refs/heads/next \\\n \t\tHEAD:refs/for/main/topic >out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t * [new branch] HEAD -> next\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new branch]      HEAD -> next\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -251,15 +251,15 @@ test_expect_success \"proc-receive: bad protocol (no ref, $PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic\\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok\n-\tremote: error: proc-receive reported incomplete status line: \"ok\"\n-\tTo <URL/of/upstream.git>\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok        Z\n+\t> remote: error: proc-receive reported incomplete status line: \"ok\"        Z\n+\t> To <URL/of/upstream.git>\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -284,15 +284,15 @@ test_expect_success \"proc-receive: bad protocol (unknown status, $PROTOCOL)\" '\n \t\t\tHEAD:refs/for/main/topic \\\n \t\t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> xx refs/for/main/topic\n-\tremote: error: proc-receive reported bad status \"xx\" on ref \"refs/for/main/topic\"\n-\tTo <URL/of/upstream.git>\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> xx refs/for/main/topic        Z\n+\t> remote: error: proc-receive reported bad status \"xx\" on ref \"refs/for/main/topic\"        Z\n+\t> To <URL/of/upstream.git>\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0014-bad-protocol--porcelain.sh b/t/t5411/test-0014-bad-protocol--porcelain.sh\nindex a44649789c..3eaa597e0f 100644\n--- a/t/t5411/test-0014-bad-protocol--porcelain.sh\n+++ b/t/t5411/test-0014-bad-protocol--porcelain.sh\n@@ -20,7 +20,7 @@ test_expect_success \"proc-receive: bad protocol (unknown version, $PROTOCOL/porc\n \t\t<actual >actual-report &&\n \tcat >expect <<-EOF &&\n \tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n+\t!\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n \tDone\n \tEOF\n \ttest_cmp expect actual-report &&\n@@ -29,8 +29,8 @@ test_expect_success \"proc-receive: bad protocol (unknown version, $PROTOCOL/porc\n \t# message (\"remote: fatal: the remote end hung up unexpectedly\") which\n \t# is different from the remote HTTP server with different locale settings.\n \tgrep \"^remote: error:\" <actual >actual-error &&\n-\tcat >expect <<-EOF &&\n-\tremote: error: proc-receive version \"2\" is not supported\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: error: proc-receive version \"2\" is not supported        Z\n \tEOF\n \ttest_cmp expect actual-error &&\n \n@@ -58,7 +58,7 @@ test_expect_success \"proc-receive: bad protocol (hook --die-read-version, $PROTO\n \t\t<out-$test_count >actual &&\n \tcat >expect <<-EOF &&\n \tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n+\t!\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n \tDone\n \tEOF\n \ttest_cmp expect actual &&\n@@ -89,7 +89,7 @@ test_expect_success \"proc-receive: bad protocol (hook --die-write-version, $PROT\n \t\t<out-$test_count >actual &&\n \tcat >expect <<-EOF &&\n \tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n+\t!\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n \tDone\n \tEOF\n \ttest_cmp expect actual &&\n@@ -120,7 +120,7 @@ test_expect_success \"proc-receive: bad protocol (hook --die-read-commands, $PROT\n \t\t<out-$test_count >actual &&\n \tcat >expect <<-EOF &&\n \tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n+\t!\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n \tDone\n \tEOF\n \ttest_cmp expect actual &&\n@@ -152,7 +152,7 @@ test_expect_success \"proc-receive: bad protocol (hook --die-read-push-options, $\n \t\t<out-$test_count >actual &&\n \tcat >expect <<-EOF &&\n \tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n+\t!\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n \tDone\n \tEOF\n \ttest_cmp expect actual &&\n@@ -182,7 +182,7 @@ test_expect_success \"proc-receive: bad protocol (hook --die-write-report, $PROTO\n \t\t<out-$test_count >actual &&\n \tcat >expect <<-EOF &&\n \tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (fail to run proc-receive hook)\n+\t!\tHEAD:refs/for/main/topic\t[remote rejected] (fail to run proc-receive hook)\n \tDone\n \tEOF\n \ttest_cmp expect actual &&\n@@ -208,18 +208,18 @@ test_expect_success \"proc-receive: bad protocol (no report, $PROTOCOL/porcelain)\n \t\tHEAD:refs/heads/next \\\n \t\tHEAD:refs/for/main/topic >out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/heads/next    [new branch]\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (proc-receive failed to report status)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/heads/next\t[new branch]\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (proc-receive failed to report status)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -251,16 +251,16 @@ test_expect_success \"proc-receive: bad protocol (no ref, $PROTOCOL/porcelain)\" '\n \t\tHEAD:refs/for/main/topic\\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok\n-\tremote: error: proc-receive reported incomplete status line: \"ok\"\n-\tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (proc-receive failed to report status)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok        Z\n+\t> remote: error: proc-receive reported incomplete status line: \"ok\"        Z\n+\t> To <URL/of/upstream.git>\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (proc-receive failed to report status)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -285,16 +285,16 @@ test_expect_success \"proc-receive: bad protocol (unknown status, $PROTOCOL/porce\n \t\t\tHEAD:refs/for/main/topic \\\n \t\t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> xx refs/for/main/topic\n-\tremote: error: proc-receive reported bad status \"xx\" on ref \"refs/for/main/topic\"\n-\tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (proc-receive failed to report status)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> xx refs/for/main/topic        Z\n+\t> remote: error: proc-receive reported bad status \"xx\" on ref \"refs/for/main/topic\"        Z\n+\t> To <URL/of/upstream.git>\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (proc-receive failed to report status)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0020-report-ng.sh b/t/t5411/test-0020-report-ng.sh\nindex ad2c8f6535..e915dbc28d 100644\n--- a/t/t5411/test-0020-report-ng.sh\n+++ b/t/t5411/test-0020-report-ng.sh\n@@ -14,14 +14,14 @@ test_expect_success \"proc-receive: fail to update (ng, no message, $PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ng refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (failed)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ng refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (failed)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -46,14 +46,14 @@ test_expect_success \"proc-receive: fail to update (ng, with message, $PROTOCOL)\"\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ng refs/for/main/topic error msg\n-\tTo <URL/of/upstream.git>\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (error msg)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ng refs/for/main/topic error msg        Z\n+\t> To <URL/of/upstream.git>\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (error msg)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0021-report-ng--porcelain.sh b/t/t5411/test-0021-report-ng--porcelain.sh\nindex d8ae9d3414..2a392e099b 100644\n--- a/t/t5411/test-0021-report-ng--porcelain.sh\n+++ b/t/t5411/test-0021-report-ng--porcelain.sh\n@@ -14,15 +14,15 @@ test_expect_success \"proc-receive: fail to update (ng, no message, $PROTOCOL/por\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ng refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (failed)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ng refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (failed)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -47,15 +47,15 @@ test_expect_success \"proc-receive: fail to update (ng, with message, $PROTOCOL/p\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ng refs/for/main/topic error msg\n-\tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (error msg)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ng refs/for/main/topic error msg        Z\n+\t> To <URL/of/upstream.git>\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (error msg)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0022-report-unexpect-ref.sh b/t/t5411/test-0022-report-unexpect-ref.sh\nindex dbed467186..a2ce7ebdf6 100644\n--- a/t/t5411/test-0022-report-unexpect-ref.sh\n+++ b/t/t5411/test-0022-report-unexpect-ref.sh\n@@ -15,19 +15,19 @@ test_expect_success \"proc-receive: report unexpected ref ($PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/heads/main\n-\tremote: error: proc-receive reported status on unexpected ref: refs/heads/main\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> <COMMIT-B> -> main\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/heads/main        Z\n+\t> remote: error: proc-receive reported status on unexpected ref: refs/heads/main        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  <COMMIT-B> -> main\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0023-report-unexpect-ref--porcelain.sh b/t/t5411/test-0023-report-unexpect-ref--porcelain.sh\nindex e89096fa13..4e56b163f8 100644\n--- a/t/t5411/test-0023-report-unexpect-ref--porcelain.sh\n+++ b/t/t5411/test-0023-report-unexpect-ref--porcelain.sh\n@@ -15,20 +15,20 @@ test_expect_success \"proc-receive: report unexpected ref ($PROTOCOL/porcelain)\"\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/heads/main\n-\tremote: error: proc-receive reported status on unexpected ref: refs/heads/main\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tTo <URL/of/upstream.git>\n-\t     <COMMIT-B>:refs/heads/main    <OID-A>..<OID-B>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (proc-receive failed to report status)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/heads/main        Z\n+\t> remote: error: proc-receive reported status on unexpected ref: refs/heads/main        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \t<COMMIT-B>:refs/heads/main\t<OID-A>..<OID-B>\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (proc-receive failed to report status)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0024-report-unknown-ref.sh b/t/t5411/test-0024-report-unknown-ref.sh\nindex 77204244b8..af055aa086 100644\n--- a/t/t5411/test-0024-report-unknown-ref.sh\n+++ b/t/t5411/test-0024-report-unknown-ref.sh\n@@ -14,15 +14,15 @@ test_expect_success \"proc-receive: report unknown reference ($PROTOCOL)\" '\n \t\tHEAD:refs/for/a/b/c/my/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: error: proc-receive reported status on unknown ref: refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t ! [remote rejected] HEAD -> refs/for/a/b/c/my/topic (proc-receive failed to report status)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: error: proc-receive reported status on unknown ref: refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  ! [remote rejected] HEAD -> refs/for/a/b/c/my/topic (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0025-report-unknown-ref--porcelain.sh b/t/t5411/test-0025-report-unknown-ref--porcelain.sh\nindex eeb1ce6b2c..99601ca321 100644\n--- a/t/t5411/test-0025-report-unknown-ref--porcelain.sh\n+++ b/t/t5411/test-0025-report-unknown-ref--porcelain.sh\n@@ -14,16 +14,16 @@ test_expect_success \"proc-receive: report unknown reference ($PROTOCOL/porcelain\n \t\tHEAD:refs/for/a/b/c/my/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: error: proc-receive reported status on unknown ref: refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/a/b/c/my/topic    [remote rejected] (proc-receive failed to report status)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: error: proc-receive reported status on unknown ref: refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t> !\tHEAD:refs/for/a/b/c/my/topic\t[remote rejected] (proc-receive failed to report status)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0026-push-options.sh b/t/t5411/test-0026-push-options.sh\nindex 1ec2cb95bc..fec5f95793 100644\n--- a/t/t5411/test-0026-push-options.sh\n+++ b/t/t5411/test-0026-push-options.sh\n@@ -52,19 +52,19 @@ test_expect_success \"proc-receive: ignore push-options for version 0 ($PROTOCOL)\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t * [new branch] HEAD -> next\n-\t * [new reference] HEAD -> refs/for/main/topic\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new branch]      HEAD -> next\n+\t>  * [new reference]   HEAD -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -101,22 +101,22 @@ test_expect_success \"proc-receive: push with options ($PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive: atomic push_options\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive< issue=123\n-\tremote: proc-receive< reviewer=user1\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t * [new branch] HEAD -> next\n-\t * [new reference] HEAD -> refs/for/main/topic\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive: atomic push_options        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive< issue=123        Z\n+\t> remote: proc-receive< reviewer=user1        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new branch]      HEAD -> next\n+\t>  * [new reference]   HEAD -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0027-push-options--porcelain.sh b/t/t5411/test-0027-push-options--porcelain.sh\nindex 447fbfec0c..8fb75a8789 100644\n--- a/t/t5411/test-0027-push-options--porcelain.sh\n+++ b/t/t5411/test-0027-push-options--porcelain.sh\n@@ -54,20 +54,20 @@ test_expect_success \"proc-receive: ignore push-options for version 0 ($PROTOCOL/\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/heads/next    [new branch]\n-\t*    HEAD:refs/for/main/topic    [new reference]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/heads/next\t[new branch]\n+\t> *\tHEAD:refs/for/main/topic\t[new reference]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -105,23 +105,23 @@ test_expect_success \"proc-receive: push with options ($PROTOCOL/porcelain)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive: atomic push_options\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive< issue=123\n-\tremote: proc-receive< reviewer=user1\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/heads/next    [new branch]\n-\t*    HEAD:refs/for/main/topic    [new reference]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive: atomic push_options        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive< issue=123        Z\n+\t> remote: proc-receive< reviewer=user1        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/heads/next\t[new branch]\n+\t> *\tHEAD:refs/for/main/topic\t[new reference]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0030-report-ok.sh b/t/t5411/test-0030-report-ok.sh\nindex 8acb4f204f..a3a6278213 100644\n--- a/t/t5411/test-0030-report-ok.sh\n+++ b/t/t5411/test-0030-report-ok.sh\n@@ -14,16 +14,16 @@ test_expect_success \"proc-receive: ok ($PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t * [new reference] HEAD -> refs/for/main/topic\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new reference]   HEAD -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0031-report-ok--porcelain.sh b/t/t5411/test-0031-report-ok--porcelain.sh\nindex a967718046..0e175388b6 100644\n--- a/t/t5411/test-0031-report-ok--porcelain.sh\n+++ b/t/t5411/test-0031-report-ok--porcelain.sh\n@@ -14,17 +14,17 @@ test_expect_success \"proc-receive: ok ($PROTOCOL/porcelain)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/for/main/topic    [new reference]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/for/main/topic\t[new reference]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0032-report-with-options.sh b/t/t5411/test-0032-report-with-options.sh\nindex 437ade012d..cd4f213a7d 100644\n--- a/t/t5411/test-0032-report-with-options.sh\n+++ b/t/t5411/test-0032-report-with-options.sh\n@@ -15,16 +15,16 @@ test_expect_success \"proc-receive: report option without matching ok ($PROTOCOL)\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: error: proc-receive reported \"option\" without a matching \"ok/ng\" directive\n-\tTo <URL/of/upstream.git>\n-\t ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: error: proc-receive reported \"option\" without a matching \"ok/ng\" directive        Z\n+\t> To <URL/of/upstream.git>\n+\t>  ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -46,17 +46,17 @@ test_expect_success \"proc-receive: report option refname ($PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head\n-\tTo <URL/of/upstream.git>\n-\t * [new reference] HEAD -> refs/pull/123/head\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new reference]   HEAD -> refs/pull/123/head\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -78,18 +78,18 @@ test_expect_success \"proc-receive: report option refname and forced-update ($PRO\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option forced-update\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head\n-\tTo <URL/of/upstream.git>\n-\t * [new reference] HEAD -> refs/pull/123/head\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new reference]   HEAD -> refs/pull/123/head\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -112,18 +112,18 @@ test_expect_success \"proc-receive: report option refname and old-oid ($PROTOCOL)\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head\n-\tTo <URL/of/upstream.git>\n-\t <OID-B>..<OID-A> HEAD -> refs/pull/123/head\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-B>..<OID-A>  HEAD -> refs/pull/123/head\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -145,17 +145,17 @@ test_expect_success \"proc-receive: report option old-oid ($PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t <OID-B>..<OID-A> HEAD -> refs/for/main/topic\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-B>..<OID-A>  HEAD -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -178,18 +178,18 @@ test_expect_success \"proc-receive: report option old-oid and new-oid ($PROTOCOL)\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> HEAD -> refs/for/main/topic\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -219,31 +219,31 @@ test_expect_success \"proc-receive: report with multiple rewrites ($PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/a/b/c/topic\n-\tremote: proc-receive> ok refs/for/next/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/124/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: proc-receive> option forced-update\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head\n-\tTo <URL/of/upstream.git>\n-\t * [new reference] HEAD -> refs/pull/123/head\n-\t * [new reference] HEAD -> refs/for/a/b/c/topic\n-\t + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/a/b/c/topic        Z\n+\t> remote: proc-receive> ok refs/for/next/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/124/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new reference]   HEAD -> refs/pull/123/head\n+\t>  * [new reference]   HEAD -> refs/for/a/b/c/topic\n+\t>  + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0033-report-with-options--porcelain.sh b/t/t5411/test-0033-report-with-options--porcelain.sh\nindex 11486720ee..7433870e40 100644\n--- a/t/t5411/test-0033-report-with-options--porcelain.sh\n+++ b/t/t5411/test-0033-report-with-options--porcelain.sh\n@@ -15,17 +15,17 @@ test_expect_success \"proc-receive: report option without matching ok ($PROTOCOL/\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: error: proc-receive reported \"option\" without a matching \"ok/ng\" directive\n-\tTo <URL/of/upstream.git>\n-\t!    HEAD:refs/for/main/topic    [remote rejected] (proc-receive failed to report status)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: error: proc-receive reported \"option\" without a matching \"ok/ng\" directive        Z\n+\t> To <URL/of/upstream.git>\n+\t> !\tHEAD:refs/for/main/topic\t[remote rejected] (proc-receive failed to report status)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -47,18 +47,18 @@ test_expect_success \"proc-receive: report option refname ($PROTOCOL/porcelain)\"\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/pull/123/head    [new reference]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/pull/123/head\t[new reference]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -81,19 +81,19 @@ test_expect_success \"proc-receive: report option refname and forced-update ($PRO\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option forced-update\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/pull/123/head    [new reference]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/pull/123/head\t[new reference]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -116,19 +116,19 @@ test_expect_success \"proc-receive: report option refname and old-oid ($PROTOCOL/\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head\n-\tTo <URL/of/upstream.git>\n-\t     HEAD:refs/pull/123/head    <OID-B>..<OID-A>\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \tHEAD:refs/pull/123/head\t<OID-B>..<OID-A>\n+\t> Done\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -150,18 +150,18 @@ test_expect_success \"proc-receive: report option old-oid ($PROTOCOL/porcelain)\"\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t     HEAD:refs/for/main/topic    <OID-B>..<OID-A>\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \tHEAD:refs/for/main/topic\t<OID-B>..<OID-A>\n+\t> Done\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -184,19 +184,19 @@ test_expect_success \"proc-receive: report option old-oid and new-oid ($PROTOCOL/\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t     HEAD:refs/for/main/topic    <OID-A>..<OID-B>\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n+\t> Done\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -227,32 +227,32 @@ test_expect_success \"proc-receive: report with multiple rewrites ($PROTOCOL/porc\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/a/b/c/topic\n-\tremote: proc-receive> ok refs/for/next/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/124/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: proc-receive> option forced-update\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/pull/123/head    [new reference]\n-\t*    HEAD:refs/for/a/b/c/topic    [new reference]\n-\t+    HEAD:refs/pull/124/head    <OID-B>...<OID-A> (forced update)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/a/b/c/topic        Z\n+\t> remote: proc-receive> ok refs/for/next/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/124/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/123/head        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/topic        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/pull/123/head\t[new reference]\n+\t> *\tHEAD:refs/for/a/b/c/topic\t[new reference]\n+\t> +\tHEAD:refs/pull/124/head\t<OID-B>...<OID-A> (forced update)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0034-report-ft.sh b/t/t5411/test-0034-report-ft.sh\nindex 6e0d08b327..73a47d1ffd 100644\n--- a/t/t5411/test-0034-report-ft.sh\n+++ b/t/t5411/test-0034-report-ft.sh\n@@ -15,17 +15,17 @@ test_expect_success \"proc-receive: fall throught, let receive-pack to execute ($\n \t\t$B:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option fall-through\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t * [new reference] <COMMIT-B> -> refs/for/main/topic\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new reference]   <COMMIT-B> -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0035-report-ft--porcelain.sh b/t/t5411/test-0035-report-ft--porcelain.sh\nindex 81bae9f2ec..c350201107 100644\n--- a/t/t5411/test-0035-report-ft--porcelain.sh\n+++ b/t/t5411/test-0035-report-ft--porcelain.sh\n@@ -15,18 +15,18 @@ test_expect_success \"proc-receive: fall throught, let receive-pack to execute ($\n \t\t$B:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option fall-through\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t*    <COMMIT-B>:refs/for/main/topic    [new reference]\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-B> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\t<COMMIT-B>:refs/for/main/topic\t[new reference]\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh b/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh\nindex be9b18b2b6..e3f456ca5a 100644\n--- a/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh\n+++ b/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh\n@@ -39,30 +39,30 @@ test_expect_success \"proc-receive: multiple rewrite for one ref, no refname for\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/24/124/1\n-\tremote: proc-receive> option old-oid <ZERO-OID>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/25/125/1\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> HEAD -> refs/for/main/topic\n-\t * [new reference] HEAD -> refs/changes/24/124/1\n-\t <OID-A>..<OID-B> HEAD -> refs/changes/25/125/1\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/24/124/1        Z\n+\t> remote: proc-receive> option old-oid <ZERO-OID>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/25/125/1        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n+\t>  * [new reference]   HEAD -> refs/changes/24/124/1\n+\t>    <OID-A>..<OID-B>  HEAD -> refs/changes/25/125/1\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -113,31 +113,31 @@ test_expect_success \"proc-receive: multiple rewrites for one ref, no refname for\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/24/124/1\n-\tremote: proc-receive> option old-oid <ZERO-OID>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/25/125/1\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> option forced-update\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1\n-\tTo <URL/of/upstream.git>\n-\t * [new reference] HEAD -> refs/changes/24/124/1\n-\t <OID-A>..<OID-B> HEAD -> refs/for/main/topic\n-\t + <OID-B>...<OID-A> HEAD -> refs/changes/25/125/1 (forced update)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/24/124/1        Z\n+\t> remote: proc-receive> option old-oid <ZERO-OID>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/25/125/1        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new reference]   HEAD -> refs/changes/24/124/1\n+\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n+\t>  + <OID-B>...<OID-A> HEAD -> refs/changes/25/125/1 (forced update)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -182,23 +182,23 @@ test_expect_success \"proc-receive: multiple rewrites for one ref ($PROTOCOL)\" '\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/23/123/1\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/24/124/2\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2\n-\tTo <URL/of/upstream.git>\n-\t * [new reference] HEAD -> refs/changes/23/123/1\n-\t <OID-A>..<OID-B> HEAD -> refs/changes/24/124/2\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/23/123/1        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/24/124/2        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2        Z\n+\t> To <URL/of/upstream.git>\n+\t>  * [new reference]   HEAD -> refs/changes/23/123/1\n+\t>    <OID-A>..<OID-B>  HEAD -> refs/changes/24/124/2\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh b/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh\nindex 95fb89c031..7786079ba5 100644\n--- a/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh\n+++ b/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh\n@@ -24,31 +24,31 @@ test_expect_success \"proc-receive: multiple rewrite for one ref, no refname for\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/24/124/1\n-\tremote: proc-receive> option old-oid <ZERO-OID>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/25/125/1\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1\n-\tTo <URL/of/upstream.git>\n-\t     HEAD:refs/for/main/topic    <OID-A>..<OID-B>\n-\t*    HEAD:refs/changes/24/124/1    [new reference]\n-\t     HEAD:refs/changes/25/125/1    <OID-A>..<OID-B>\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/24/124/1        Z\n+\t> remote: proc-receive> option old-oid <ZERO-OID>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/25/125/1        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n+\t> *\tHEAD:refs/changes/24/124/1\t[new reference]\n+\t>  \tHEAD:refs/changes/25/125/1\t<OID-A>..<OID-B>\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -84,32 +84,32 @@ test_expect_success \"proc-receive: multiple rewrites for one ref, no refname for\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/24/124/1\n-\tremote: proc-receive> option old-oid <ZERO-OID>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/25/125/1\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> option forced-update\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/changes/24/124/1    [new reference]\n-\t     HEAD:refs/for/main/topic    <OID-A>..<OID-B>\n-\t+    HEAD:refs/changes/25/125/1    <OID-B>...<OID-A> (forced update)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/24/124/1        Z\n+\t> remote: proc-receive> option old-oid <ZERO-OID>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/25/125/1        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/changes/24/124/1\t[new reference]\n+\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n+\t> +\tHEAD:refs/changes/25/125/1\t<OID-B>...<OID-A> (forced update)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -139,24 +139,24 @@ test_expect_success \"proc-receive: multiple rewrites for one ref ($PROTOCOL/porc\n \t\tHEAD:refs/for/main/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/23/123/1\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/changes/24/124/2\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2\n-\tTo <URL/of/upstream.git>\n-\t*    HEAD:refs/changes/23/123/1    [new reference]\n-\t     HEAD:refs/changes/24/124/2    <OID-A>..<OID-B>\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/23/123/1        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/changes/24/124/2        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/23/123/1        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2        Z\n+\t> To <URL/of/upstream.git>\n+\t> *\tHEAD:refs/changes/23/123/1\t[new reference]\n+\t>  \tHEAD:refs/changes/24/124/2\t<OID-A>..<OID-B>\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0038-report-mixed-refs.sh b/t/t5411/test-0038-report-mixed-refs.sh\nindex 5e005299cc..0990a3f76a 100644\n--- a/t/t5411/test-0038-report-mixed-refs.sh\n+++ b/t/t5411/test-0038-report-mixed-refs.sh\n@@ -26,43 +26,43 @@ test_expect_success \"proc-receive: report update of mixed refs ($PROTOCOL)\" '\n \t\tHEAD:refs/for/next/topic3 \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3\n-\tremote: proc-receive> ok refs/for/next/topic2\n-\tremote: proc-receive> ng refs/for/next/topic1 fail to call Web API\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> <COMMIT-B> -> main\n-\t * [new branch] HEAD -> bar\n-\t * [new branch] HEAD -> baz\n-\t * [new reference] HEAD -> refs/for/next/topic2\n-\t * [new branch] HEAD -> foo\n-\t <OID-A>..<OID-B> HEAD -> refs/for/main/topic\n-\t ! [remote rejected] HEAD -> refs/for/next/topic1 (fail to call Web API)\n-\t ! [remote rejected] HEAD -> refs/for/next/topic3 (proc-receive failed to report status)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3        Z\n+\t> remote: proc-receive> ok refs/for/next/topic2        Z\n+\t> remote: proc-receive> ng refs/for/next/topic1 fail to call Web API        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  <COMMIT-B> -> main\n+\t>  * [new branch]      HEAD -> bar\n+\t>  * [new branch]      HEAD -> baz\n+\t>  * [new reference]   HEAD -> refs/for/next/topic2\n+\t>  * [new branch]      HEAD -> foo\n+\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n+\t>  ! [remote rejected] HEAD -> refs/for/next/topic1 (fail to call Web API)\n+\t>  ! [remote rejected] HEAD -> refs/for/next/topic3 (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0039-report-mixed-refs--porcelain.sh b/t/t5411/test-0039-report-mixed-refs--porcelain.sh\nindex 8f891c5385..7e4d08a939 100644\n--- a/t/t5411/test-0039-report-mixed-refs--porcelain.sh\n+++ b/t/t5411/test-0039-report-mixed-refs--porcelain.sh\n@@ -26,44 +26,44 @@ test_expect_success \"proc-receive: report update of mixed refs ($PROTOCOL/porcel\n \t\tHEAD:refs/for/next/topic3 \\\n \t\t>out-$test_count 2>&1 &&\n \tmake_user_friendly_and_stable_output <out-$test_count >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3\n-\tremote: proc-receive> ok refs/for/next/topic2\n-\tremote: proc-receive> ng refs/for/next/topic1 fail to call Web API\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/for/main/topic\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic\n-\tTo <URL/of/upstream.git>\n-\t     <COMMIT-B>:refs/heads/main    <OID-A>..<OID-B>\n-\t*    HEAD:refs/heads/bar    [new branch]\n-\t*    HEAD:refs/heads/baz    [new branch]\n-\t*    HEAD:refs/for/next/topic2    [new reference]\n-\t*    HEAD:refs/heads/foo    [new branch]\n-\t     HEAD:refs/for/main/topic    <OID-A>..<OID-B>\n-\t!    HEAD:refs/for/next/topic1    [remote rejected] (fail to call Web API)\n-\t!    HEAD:refs/for/next/topic3    [remote rejected] (proc-receive failed to report status)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic1        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic3        Z\n+\t> remote: proc-receive> ok refs/for/next/topic2        Z\n+\t> remote: proc-receive> ng refs/for/next/topic1 fail to call Web API        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/for/main/topic        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/bar        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/baz        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic2        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \t<COMMIT-B>:refs/heads/main\t<OID-A>..<OID-B>\n+\t> *\tHEAD:refs/heads/bar\t[new branch]\n+\t> *\tHEAD:refs/heads/baz\t[new branch]\n+\t> *\tHEAD:refs/for/next/topic2\t[new reference]\n+\t> *\tHEAD:refs/heads/foo\t[new branch]\n+\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n+\t> !\tHEAD:refs/for/next/topic1\t[remote rejected] (fail to call Web API)\n+\t> !\tHEAD:refs/for/next/topic3\t[remote rejected] (proc-receive failed to report status)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0040-process-all-refs.sh b/t/t5411/test-0040-process-all-refs.sh\nindex fdcdcc7c2e..f67cb2a7b3 100644\n--- a/t/t5411/test-0040-process-all-refs.sh\n+++ b/t/t5411/test-0040-process-all-refs.sh\n@@ -50,46 +50,46 @@ test_expect_success \"proc-receive: process all refs ($PROTOCOL)\" '\n \t\tHEAD:refs/for/next/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar\n-\tremote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo\n-\tremote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar\n-\tremote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo\n-\tremote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: proc-receive> ok refs/heads/main\n-\tremote: proc-receive> option fall-through\n-\tremote: proc-receive> ok refs/heads/foo\n-\tremote: proc-receive> option fall-through\n-\tremote: proc-receive> ok refs/heads/bar\n-\tremote: proc-receive> option fall-through\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: proc-receive> ok refs/for/next/topic\n-\tremote: proc-receive> option refname refs/pull/124/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> option forced-update\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar\n-\tremote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> <COMMIT-B> -> bar\n-\t - [deleted] foo\n-\t + <OID-B>...<OID-A> HEAD -> main (forced update)\n-\t <OID-A>..<OID-B> HEAD -> refs/pull/123/head\n-\t + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar        Z\n+\t> remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo        Z\n+\t> remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar        Z\n+\t> remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo        Z\n+\t> remote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: proc-receive> ok refs/heads/main        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: proc-receive> ok refs/heads/foo        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: proc-receive> ok refs/heads/bar        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> ok refs/for/next/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/124/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar        Z\n+\t> remote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  <COMMIT-B> -> bar\n+\t>  - [deleted]         foo\n+\t>  + <OID-B>...<OID-A> HEAD -> main (forced update)\n+\t>    <OID-A>..<OID-B>  HEAD -> refs/pull/123/head\n+\t>  + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0041-process-all-refs--porcelain.sh b/t/t5411/test-0041-process-all-refs--porcelain.sh\nindex 73b35fe0aa..7d1a99d3a2 100644\n--- a/t/t5411/test-0041-process-all-refs--porcelain.sh\n+++ b/t/t5411/test-0041-process-all-refs--porcelain.sh\n@@ -50,47 +50,47 @@ test_expect_success \"proc-receive: process all refs ($PROTOCOL/porcelain)\" '\n \t\tHEAD:refs/for/next/topic \\\n \t\t>out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar\n-\tremote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo\n-\tremote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar\n-\tremote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo\n-\tremote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic\n-\tremote: proc-receive> ok refs/heads/main\n-\tremote: proc-receive> option fall-through\n-\tremote: proc-receive> ok refs/heads/foo\n-\tremote: proc-receive> option fall-through\n-\tremote: proc-receive> ok refs/heads/bar\n-\tremote: proc-receive> option fall-through\n-\tremote: proc-receive> ok refs/for/main/topic\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: proc-receive> ok refs/for/next/topic\n-\tremote: proc-receive> option refname refs/pull/124/head\n-\tremote: proc-receive> option old-oid <COMMIT-B>\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: proc-receive> option forced-update\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar\n-\tremote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head\n-\tremote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head\n-\tTo <URL/of/upstream.git>\n-\t     <COMMIT-B>:refs/heads/bar    <OID-A>..<OID-B>\n-\t-    :refs/heads/foo    [deleted]\n-\t+    HEAD:refs/heads/main    <OID-B>...<OID-A> (forced update)\n-\t     HEAD:refs/pull/123/head    <OID-A>..<OID-B>\n-\t+    HEAD:refs/pull/124/head    <OID-B>...<OID-A> (forced update)\n-\tDone\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar        Z\n+\t> remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo        Z\n+\t> remote: pre-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar        Z\n+\t> remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo        Z\n+\t> remote: proc-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/for/next/topic        Z\n+\t> remote: proc-receive> ok refs/heads/main        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: proc-receive> ok refs/heads/foo        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: proc-receive> ok refs/heads/bar        Z\n+\t> remote: proc-receive> option fall-through        Z\n+\t> remote: proc-receive> ok refs/for/main/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> ok refs/for/next/topic        Z\n+\t> remote: proc-receive> option refname refs/pull/124/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option forced-update        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/bar        Z\n+\t> remote: post-receive< <COMMIT-A> <ZERO-OID> refs/heads/foo        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/heads/main        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head        Z\n+\t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>  \t<COMMIT-B>:refs/heads/bar\t<OID-A>..<OID-B>\n+\t> -\t:refs/heads/foo\t[deleted]\n+\t> +\tHEAD:refs/heads/main\t<OID-B>...<OID-A> (forced update)\n+\t>  \tHEAD:refs/pull/123/head\t<OID-A>..<OID-B>\n+\t> +\tHEAD:refs/pull/124/head\t<OID-B>...<OID-A> (forced update)\n+\t> Done\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh b/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh\nindex 7214647ada..dba544162c 100644\n--- a/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh\n+++ b/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh\n@@ -29,25 +29,25 @@ test_expect_success \"proc-receive: update branch and new tag ($PROTOCOL)\" '\n \t\t$B:refs/heads/main \\\n \t\tv123 >out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/main\n-\tremote: proc-receive< <ZERO-OID> <TAG-v123> refs/tags/v123\n-\tremote: proc-receive> ok refs/heads/main\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <COMMIT-B>\n-\tremote: proc-receive> ok refs/tags/v123\n-\tremote: proc-receive> option refname refs/pull/124/head\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head\n-\tremote: post-receive< <ZERO-OID> <TAG-v123> refs/pull/124/head\n-\tTo <URL/of/upstream.git>\n-\t <OID-A>..<OID-B> <COMMIT-B> -> refs/pull/123/head\n-\t * [new reference] v123 -> refs/pull/124/head\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: pre-receive< <ZERO-OID> <TAG-v123> refs/tags/v123        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n+\t> remote: proc-receive< <ZERO-OID> <TAG-v123> refs/tags/v123        Z\n+\t> remote: proc-receive> ok refs/heads/main        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-B>        Z\n+\t> remote: proc-receive> ok refs/tags/v123         Z\n+\t> remote: proc-receive> option refname refs/pull/124/head        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head        Z\n+\t> remote: post-receive< <ZERO-OID> <TAG-v123> refs/pull/124/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>    <OID-A>..<OID-B>  <COMMIT-B> -> refs/pull/123/head\n+\t>  * [new reference]   v123 -> refs/pull/124/head\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -93,32 +93,32 @@ test_expect_success \"proc-receive: create/delete branch, and delete tag ($PROTOC\n \t\t$A:refs/heads/next \\\n \t\t:refs/tags/v123 >out 2>&1 &&\n \tmake_user_friendly_and_stable_output <out >actual &&\n-\tcat >expect <<-EOF &&\n-\tremote: # pre-receive hook\n-\tremote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/main\n-\tremote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic\n-\tremote: pre-receive< <TAG-v123> <ZERO-OID> refs/tags/v123\n-\tremote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: # proc-receive hook\n-\tremote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/main\n-\tremote: proc-receive< <ZERO-OID> <COMMIT-A> refs/heads/next\n-\tremote: proc-receive> ok refs/heads/main\n-\tremote: proc-receive> option refname refs/pull/123/head\n-\tremote: proc-receive> option old-oid <COMMIT-A>\n-\tremote: proc-receive> option new-oid <ZERO-OID>\n-\tremote: proc-receive> ok refs/heads/next\n-\tremote: proc-receive> option refname refs/pull/124/head\n-\tremote: proc-receive> option new-oid <COMMIT-A>\n-\tremote: # post-receive hook\n-\tremote: post-receive< <COMMIT-A> <ZERO-OID> refs/pull/123/head\n-\tremote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic\n-\tremote: post-receive< <TAG-v123> <ZERO-OID> refs/tags/v123\n-\tremote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/124/head\n-\tTo <URL/of/upstream.git>\n-\t - [deleted] refs/pull/123/head\n-\t <OID-A>..<OID-B> <COMMIT-B> -> topic\n-\t - [deleted] v123\n-\t * [new reference] <COMMIT-A> -> refs/pull/124/head\n+\tformat_and_save_expect <<-EOF &&\n+\t> remote: # pre-receive hook        Z\n+\t> remote: pre-receive< <COMMIT-A> <ZERO-OID> refs/heads/main        Z\n+\t> remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic        Z\n+\t> remote: pre-receive< <TAG-v123> <ZERO-OID> refs/tags/v123        Z\n+\t> remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: # proc-receive hook        Z\n+\t> remote: proc-receive< <COMMIT-A> <ZERO-OID> refs/heads/main        Z\n+\t> remote: proc-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n+\t> remote: proc-receive> ok refs/heads/main        Z\n+\t> remote: proc-receive> option refname refs/pull/123/head        Z\n+\t> remote: proc-receive> option old-oid <COMMIT-A>        Z\n+\t> remote: proc-receive> option new-oid <ZERO-OID>        Z\n+\t> remote: proc-receive> ok refs/heads/next        Z\n+\t> remote: proc-receive> option refname refs/pull/124/head        Z\n+\t> remote: proc-receive> option new-oid <COMMIT-A>        Z\n+\t> remote: # post-receive hook        Z\n+\t> remote: post-receive< <COMMIT-A> <ZERO-OID> refs/pull/123/head        Z\n+\t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/topic        Z\n+\t> remote: post-receive< <TAG-v123> <ZERO-OID> refs/tags/v123        Z\n+\t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/124/head        Z\n+\t> To <URL/of/upstream.git>\n+\t>  - [deleted]         refs/pull/123/head\n+\t>    <OID-A>..<OID-B>  <COMMIT-B> -> topic\n+\t>  - [deleted]         v123\n+\t>  * [new reference]   <COMMIT-A> -> refs/pull/124/head\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5548-push-porcelain.sh b/t/t5548-push-porcelain.sh\nindex 5a761f3642..2ab7c3cf5a 100755\n--- a/t/t5548-push-porcelain.sh\n+++ b/t/t5548-push-porcelain.sh\n@@ -45,9 +45,6 @@ create_commits_in () {\n # of the output.\n make_user_friendly_and_stable_output () {\n \tsed \\\n-\t\t-e \"s/  *\\$//\" \\\n-\t\t-e \"s/   */ /g\" \\\n-\t\t-e \"s/\t/    /g\" \\\n \t\t-e \"s/$A/<COMMIT-A>/g\" \\\n \t\t-e \"s/$B/<COMMIT-B>/g\" \\\n \t\t-e \"s/$ZERO_OID/<ZERO-OID>/g\" \\\n@@ -56,6 +53,10 @@ make_user_friendly_and_stable_output () {\n \t\t-e \"s#To $URL_PREFIX/upstream.git#To <URL/of/upstream.git>#\"\n }\n \n+format_and_save_expect () {\n+\tsed -e 's/^> //' -e 's/Z$//' >expect\n+}\n+\n setup_upstream_and_workbench () {\n \t# Upstream  after setup : main(B)  foo(A)  bar(A)  baz(A)\n \t# Workbench after setup : main(A)\n@@ -111,14 +112,14 @@ run_git_push_porcelain_output_test() {\n \t\t\t\tnext\n \t\t) >out &&\n \t\tmake_user_friendly_and_stable_output <out >actual &&\n-\t\tcat >expect <<-EOF &&\n-\t\tTo <URL/of/upstream.git>\n-\t\t=    refs/heads/baz:refs/heads/baz    [up to date]\n-\t\t     <COMMIT-B>:refs/heads/bar    <OID-A>..<OID-B>\n-\t\t-    :refs/heads/foo    [deleted]\n-\t\t+    refs/heads/main:refs/heads/main    <OID-B>...<OID-A> (forced update)\n-\t\t*    refs/heads/next:refs/heads/next    [new branch]\n-\t\tDone\n+\t\tformat_and_save_expect <<-EOF &&\n+\t\t> To <URL/of/upstream.git>\n+\t\t> =\trefs/heads/baz:refs/heads/baz\t[up to date]\n+\t\t>  \t<COMMIT-B>:refs/heads/bar\t<OID-A>..<OID-B>\n+\t\t> -\t:refs/heads/foo\t[deleted]\n+\t\t> +\trefs/heads/main:refs/heads/main\t<OID-B>...<OID-A> (forced update)\n+\t\t> *\trefs/heads/next:refs/heads/next\t[new branch]\n+\t\t> Done\n \t\tEOF\n \t\ttest_cmp expect actual &&\n \n@@ -148,12 +149,12 @@ run_git_push_porcelain_output_test() {\n \t\t\t\tnext\n \t\t) >out &&\n \t\tmake_user_friendly_and_stable_output <out >actual &&\n-\t\tcat >expect <<-EOF &&\n+\t\tformat_and_save_expect <<-EOF &&\n \t\tTo <URL/of/upstream.git>\n-\t\t=    refs/heads/next:refs/heads/next    [up to date]\n-\t\t!    refs/heads/bar:refs/heads/bar    [rejected] (non-fast-forward)\n-\t\t!    (delete):refs/heads/baz    [rejected] (atomic push failed)\n-\t\t!    refs/heads/main:refs/heads/main    [rejected] (atomic push failed)\n+\t\t> =\trefs/heads/next:refs/heads/next\t[up to date]\n+\t\t> !\trefs/heads/bar:refs/heads/bar\t[rejected] (non-fast-forward)\n+\t\t> !\t(delete):refs/heads/baz\t[rejected] (atomic push failed)\n+\t\t> !\trefs/heads/main:refs/heads/main\t[rejected] (atomic push failed)\n \t\tDone\n \t\tEOF\n \t\ttest_cmp expect actual &&\n@@ -168,6 +169,7 @@ run_git_push_porcelain_output_test() {\n \t\tEOF\n \t\ttest_cmp expect actual\n \t'\n+\n \ttest_expect_success \"prepare pre-receive hook ($PROTOCOL)\" '\n \t\twrite_script \"$upstream/hooks/pre-receive\" <<-EOF\n \t\texit 1\n@@ -189,12 +191,12 @@ run_git_push_porcelain_output_test() {\n \t\t\t\tnext\n \t\t) >out &&\n \t\tmake_user_friendly_and_stable_output <out >actual &&\n-\t\tcat >expect <<-EOF &&\n+\t\tformat_and_save_expect <<-EOF &&\n \t\tTo <URL/of/upstream.git>\n-\t\t=    refs/heads/next:refs/heads/next    [up to date]\n-\t\t!    refs/heads/bar:refs/heads/bar    [remote rejected] (pre-receive hook declined)\n-\t\t!    :refs/heads/baz    [remote rejected] (pre-receive hook declined)\n-\t\t!    refs/heads/main:refs/heads/main    [remote rejected] (pre-receive hook declined)\n+\t\t> =\trefs/heads/next:refs/heads/next\t[up to date]\n+\t\t> !\trefs/heads/bar:refs/heads/bar\t[remote rejected] (pre-receive hook declined)\n+\t\t> !\t:refs/heads/baz\t[remote rejected] (pre-receive hook declined)\n+\t\t> !\trefs/heads/main:refs/heads/main\t[remote rejected] (pre-receive hook declined)\n \t\tDone\n \t\tEOF\n \t\ttest_cmp expect actual &&\n@@ -227,12 +229,12 @@ run_git_push_porcelain_output_test() {\n \t\t\t\tnext\n \t\t) >out &&\n \t\tmake_user_friendly_and_stable_output <out >actual &&\n-\t\tcat >expect <<-EOF &&\n+\t\tformat_and_save_expect <<-EOF &&\n \t\tTo <URL/of/upstream.git>\n-\t\t=    refs/heads/next:refs/heads/next    [up to date]\n-\t\t-    :refs/heads/baz    [deleted]\n-\t\t     refs/heads/main:refs/heads/main    <OID-A>..<OID-B>\n-\t\t!    refs/heads/bar:refs/heads/bar    [rejected] (non-fast-forward)\n+\t\t> =\trefs/heads/next:refs/heads/next\t[up to date]\n+\t\t> -\t:refs/heads/baz\t[deleted]\n+\t\t>  \trefs/heads/main:refs/heads/main\t<OID-A>..<OID-B>\n+\t\t> !\trefs/heads/bar:refs/heads/bar\t[rejected] (non-fast-forward)\n \t\tDone\n \t\tEOF\n \t\ttest_cmp expect actual &&\ndiff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh\nindex 881f72fd44..cf13bcc3c8 100755\n--- a/t/t6020-bundle-misc.sh\n+++ b/t/t6020-bundle-misc.sh\n@@ -82,7 +82,7 @@ test_commit_setvar () {\n \n # Format the output of git commands to make a user-friendly and stable\n # text.  We can easily prepare the expect text without having to worry\n-# about future changes of the commit ID and spaces of the output.\n+# about future changes of the commit ID.\n make_user_friendly_and_stable_output () {\n \tsed \\\n \t\t-e \"s/${A%${A#???????}}[0-9a-f]*/<COMMIT-A>/g\" \\\n@@ -103,8 +103,11 @@ make_user_friendly_and_stable_output () {\n \t\t-e \"s/${P%${P#???????}}[0-9a-f]*/<COMMIT-P>/g\" \\\n \t\t-e \"s/${TAG1%${TAG1#???????}}[0-9a-f]*/<TAG-1>/g\" \\\n \t\t-e \"s/${TAG2%${TAG2#???????}}[0-9a-f]*/<TAG-2>/g\" \\\n-\t\t-e \"s/${TAG3%${TAG3#???????}}[0-9a-f]*/<TAG-3>/g\" \\\n-\t\t-e \"s/ *\\$//\"\n+\t\t-e \"s/${TAG3%${TAG3#???????}}[0-9a-f]*/<TAG-3>/g\"\n+}\n+\n+format_and_save_expect () {\n+\tsed -e 's/Z$//' >expect\n }\n \n #            (C)   (D, pull/1/head, topic/1)\n@@ -179,11 +182,11 @@ test_expect_success 'create bundle from special rev: main^!' '\n \n \tgit bundle verify special-rev.bdl |\n \t\tmake_user_friendly_and_stable_output >actual &&\n-\tcat >expect <<-\\EOF &&\n+\tformat_and_save_expect <<-\\EOF &&\n \tThe bundle contains this ref:\n \t<COMMIT-P> refs/heads/main\n \tThe bundle requires this ref:\n-\t<COMMIT-O>\n+\t<COMMIT-O> Z\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -200,12 +203,12 @@ test_expect_success 'create bundle with --max-count option' '\n \n \tgit bundle verify max-count.bdl |\n \t\tmake_user_friendly_and_stable_output >actual &&\n-\tcat >expect <<-\\EOF &&\n+\tformat_and_save_expect <<-\\EOF &&\n \tThe bundle contains these 2 refs:\n \t<COMMIT-P> refs/heads/main\n \t<TAG-1> refs/tags/v1\n \tThe bundle requires this ref:\n-\t<COMMIT-O>\n+\t<COMMIT-O> Z\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -225,7 +228,7 @@ test_expect_success 'create bundle with --since option' '\n \n \tgit bundle verify since.bdl |\n \t\tmake_user_friendly_and_stable_output >actual &&\n-\tcat >expect <<-\\EOF &&\n+\tformat_and_save_expect <<-\\EOF &&\n \tThe bundle contains these 5 refs:\n \t<COMMIT-P> refs/heads/main\n \t<COMMIT-N> refs/heads/release\n@@ -233,8 +236,8 @@ test_expect_success 'create bundle with --since option' '\n \t<TAG-3> refs/tags/v3\n \t<COMMIT-P> HEAD\n \tThe bundle requires these 2 refs:\n-\t<COMMIT-M>\n-\t<COMMIT-K>\n+\t<COMMIT-M> Z\n+\t<COMMIT-K> Z\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -293,13 +296,13 @@ test_expect_success 'create bundle 2 - has prerequisites' '\n \t\t--stdin \\\n \t\trelease <input &&\n \n-\tcat >expect <<-\\EOF &&\n+\tformat_and_save_expect <<-\\EOF &&\n \tThe bundle contains this ref:\n \t<COMMIT-N> refs/heads/release\n \tThe bundle requires these 3 refs:\n-\t<COMMIT-D>\n-\t<COMMIT-E>\n-\t<COMMIT-G>\n+\t<COMMIT-D> Z\n+\t<COMMIT-E> Z\n+\t<COMMIT-G> Z\n \tEOF\n \n \tgit bundle verify 2.bdl |\n@@ -317,11 +320,11 @@ test_expect_success 'create bundle 2 - has prerequisites' '\n test_expect_success 'fail to verify bundle without prerequisites' '\n \tgit init --bare test1.git &&\n \n-\tcat >expect <<-\\EOF &&\n+\tformat_and_save_expect <<-\\EOF &&\n \terror: Repository lacks these prerequisite commits:\n-\terror: <COMMIT-D>\n-\terror: <COMMIT-E>\n-\terror: <COMMIT-G>\n+\terror: <COMMIT-D> Z\n+\terror: <COMMIT-E> Z\n+\terror: <COMMIT-G> Z\n \tEOF\n \n \ttest_must_fail git -C test1.git bundle verify ../2.bdl 2>&1 |\n@@ -352,13 +355,13 @@ test_expect_success 'create bundle 3 - two refs, same object' '\n \t\t--stdin \\\n \t\tmain HEAD <input &&\n \n-\tcat >expect <<-\\EOF &&\n+\tformat_and_save_expect <<-\\EOF &&\n \tThe bundle contains these 2 refs:\n \t<COMMIT-P> refs/heads/main\n \t<COMMIT-P> HEAD\n \tThe bundle requires these 2 refs:\n-\t<COMMIT-M>\n-\t<COMMIT-K>\n+\t<COMMIT-M> Z\n+\t<COMMIT-K> Z\n \tEOF\n \n \tgit bundle verify 3.bdl |\n-- \n2.32.0.rc0.27.g7b1e85181b\n\n"},{"id":"427656","messageId":"20210617031727.81105-3-zhiyou.jx@alibaba-inc.com","threadId":"55948","inReplyTo":"20210617031727.81105-1-zhiyou.jx@alibaba-inc.com","subject":"[PATCH 3/4] test: refactor to use \"test_commit\" to create commits","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2021-06-17T03:17:26Z","receivedAt":"2021-06-17T03:17:45Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Refactor function \"create_commits_in\" to use \"test_commit\" to create\ncommit.\n\nSigned-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>\n---\n t/t5411/common-functions.sh | 25 ++++++-------------------\n t/t5548-push-porcelain.sh   | 25 ++++++-------------------\n 2 files changed, 12 insertions(+), 38 deletions(-)\n\ndiff --git a/t/t5411/common-functions.sh b/t/t5411/common-functions.sh\nindex 6c347b4caa..b9c6adecf5 100644\n--- a/t/t5411/common-functions.sh\n+++ b/t/t5411/common-functions.sh\n@@ -6,29 +6,16 @@\n # NOTE: Never calling this function from a subshell since variable\n # assignments will disappear when subshell exits.\n create_commits_in () {\n-\trepo=\"$1\" &&\n-\tif ! parent=$(git -C \"$repo\" rev-parse HEAD^{} --)\n-\tthen\n-\t\tparent=\n-\tfi &&\n-\tT=$(git -C \"$repo\" write-tree) &&\n+\trepo=\"$1\" && test -d \"$repo\" ||\n+\terror \"Repository $repo does not exist.\"\n \tshift &&\n \twhile test $# -gt 0\n \tdo\n \t\tname=$1 &&\n-\t\ttest_tick &&\n-\t\tif test -z \"$parent\"\n-\t\tthen\n-\t\t\toid=$(echo $name | git -C \"$repo\" commit-tree $T)\n-\t\telse\n-\t\t\toid=$(echo $name | git -C \"$repo\" commit-tree -p $parent $T)\n-\t\tfi &&\n-\t\teval $name=$oid &&\n-\t\tparent=$oid &&\n-\t\tshift ||\n-\t\treturn 1\n-\tdone &&\n-\tgit -C \"$repo\" update-ref refs/heads/main $oid\n+\t\tshift &&\n+\t\ttest_commit -C \"$repo\" --no-tag \"$name\" &&\n+\t\teval $name=$(git -C \"$repo\" rev-parse HEAD)\n+\tdone\n }\n \n # Format the output of git-push, git-show-ref and other commands to make a\ndiff --git a/t/t5548-push-porcelain.sh b/t/t5548-push-porcelain.sh\nindex 2ab7c3cf5a..c8f18a7a12 100755\n--- a/t/t5548-push-porcelain.sh\n+++ b/t/t5548-push-porcelain.sh\n@@ -14,29 +14,16 @@ test_description='Test git push porcelain output'\n # NOTE: Never calling this function from a subshell since variable\n # assignments will disappear when subshell exits.\n create_commits_in () {\n-\trepo=\"$1\" &&\n-\tif ! parent=$(git -C \"$repo\" rev-parse HEAD^{} --)\n-\tthen\n-\t\tparent=\n-\tfi &&\n-\tT=$(git -C \"$repo\" write-tree) &&\n+\trepo=\"$1\" && test -d \"$repo\" ||\n+\terror \"Repository $repo does not exist.\"\n \tshift &&\n \twhile test $# -gt 0\n \tdo\n \t\tname=$1 &&\n-\t\ttest_tick &&\n-\t\tif test -z \"$parent\"\n-\t\tthen\n-\t\t\toid=$(echo $name | git -C \"$repo\" commit-tree $T)\n-\t\telse\n-\t\t\toid=$(echo $name | git -C \"$repo\" commit-tree -p $parent $T)\n-\t\tfi &&\n-\t\teval $name=$oid &&\n-\t\tparent=$oid &&\n-\t\tshift ||\n-\t\treturn 1\n-\tdone &&\n-\tgit -C \"$repo\" update-ref refs/heads/main $oid\n+\t\tshift &&\n+\t\ttest_commit -C \"$repo\" --no-tag \"$name\" &&\n+\t\teval $name=$(git -C \"$repo\" rev-parse HEAD)\n+\tdone\n }\n \n # Format the output of git-push, git-show-ref and other commands to make a\n-- \n2.32.0.rc0.27.g7b1e85181b\n\n"},{"id":"427658","messageId":"20210617031727.81105-4-zhiyou.jx@alibaba-inc.com","threadId":"55948","inReplyTo":"20210617031727.81105-1-zhiyou.jx@alibaba-inc.com","subject":"[PATCH 4/4] test: refactor to use \"get_abbrev_oid\" to get abbrev oid","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2021-06-17T03:17:27Z","receivedAt":"2021-06-17T03:17:48Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Add new function \"get_abbrev_oid\" to get abbrev object ID.  This\nfunction has a default value which helps to prepare a nonempty replace\npattern for sed command.  An empty replace pattern may cause sed fail\nto allocate memory.\n\nRefactor function \"make_user_friendly_and_stable_output\" to use\n\"get_abbrev_oid\" to get abbrev object ID.\n\nSigned-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>\n---\n t/t5411/common-functions.sh                   | 20 ++++++++++++----\n t/t5411/test-0000-standard-git-push.sh        |  6 ++---\n .../test-0001-standard-git-push--porcelain.sh |  6 ++---\n t/t5411/test-0022-report-unexpect-ref.sh      |  2 +-\n ...est-0023-report-unexpect-ref--porcelain.sh |  2 +-\n t/t5411/test-0032-report-with-options.sh      |  8 +++----\n ...est-0033-report-with-options--porcelain.sh |  8 +++----\n ...t-0036-report-multi-rewrite-for-one-ref.sh | 10 ++++----\n ...rt-multi-rewrite-for-one-ref--porcelain.sh | 10 ++++----\n t/t5411/test-0038-report-mixed-refs.sh        |  4 ++--\n .../test-0039-report-mixed-refs--porcelain.sh |  4 ++--\n t/t5411/test-0040-process-all-refs.sh         |  8 +++----\n .../test-0041-process-all-refs--porcelain.sh  |  8 +++----\n ...t-0050-proc-receive-refs-with-modifiers.sh |  4 ++--\n t/t5548-push-porcelain.sh                     | 24 +++++++++++++------\n 15 files changed, 72 insertions(+), 52 deletions(-)\n\ndiff --git a/t/t5411/common-functions.sh b/t/t5411/common-functions.sh\nindex b9c6adecf5..3c747782c1 100644\n--- a/t/t5411/common-functions.sh\n+++ b/t/t5411/common-functions.sh\n@@ -18,6 +18,18 @@ create_commits_in () {\n \tdone\n }\n \n+get_abbrev_oid () {\n+\toid=$1 &&\n+\tsuffix=${oid#???????} &&\n+\toid=${oid%$suffix} &&\n+\tif test -n \"$oid\"\n+\tthen\n+\t\techo \"$oid\"\n+\telse\n+\t\techo \"undefined-oid\"\n+\tfi\n+}\n+\n # Format the output of git-push, git-show-ref and other commands to make a\n # user-friendly and stable text.  We can easily prepare the expect text\n # without having to worry about changes of the commit ID (full or abbrev.)\n@@ -28,12 +40,10 @@ create_commits_in () {\n make_user_friendly_and_stable_output () {\n \tsed \\\n \t\t-e \"s/'/\\\"/g\" \\\n-\t\t-e \"s/$A/<COMMIT-A>/g\" \\\n-\t\t-e \"s/$B/<COMMIT-B>/g\" \\\n-\t\t-e \"s/$TAG/<TAG-v123>/g\" \\\n+\t\t-e \"s/$(get_abbrev_oid $A)[0-9a-f]*/<COMMIT-A>/g\" \\\n+\t\t-e \"s/$(get_abbrev_oid $B)[0-9a-f]*/<COMMIT-B>/g\" \\\n+\t\t-e \"s/$(get_abbrev_oid $TAG)[0-9a-f]*/<TAG-v123>/g\" \\\n \t\t-e \"s/$ZERO_OID/<ZERO-OID>/g\" \\\n-\t\t-e \"s/$(echo $A | cut -c1-7)[0-9a-f]*/<OID-A>/g\" \\\n-\t\t-e \"s/$(echo $B | cut -c1-7)[0-9a-f]*/<OID-B>/g\" \\\n \t\t-e \"s#To $URL_PREFIX/upstream.git#To <URL/of/upstream.git>#\" \\\n \t\t-e \"/^error: / d\"\n }\ndiff --git a/t/t5411/test-0000-standard-git-push.sh b/t/t5411/test-0000-standard-git-push.sh\nindex d8aafc235c..ce64bb660b 100644\n--- a/t/t5411/test-0000-standard-git-push.sh\n+++ b/t/t5411/test-0000-standard-git-push.sh\n@@ -15,7 +15,7 @@ test_expect_success \"git-push ($PROTOCOL)\" '\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  <COMMIT-B> -> main\n+\t>    <COMMIT-A>..<COMMIT-B>  <COMMIT-B> -> main\n \t>  * [new branch]      HEAD -> next\n \tEOF\n \ttest_cmp expect actual &&\n@@ -69,7 +69,7 @@ test_expect_success \"non-fast-forward git-push ($PROTOCOL)\" '\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  <COMMIT-B> -> next\n+\t>    <COMMIT-A>..<COMMIT-B>  <COMMIT-B> -> next\n \t>  ! [rejected]        main -> main (non-fast-forward)\n \tEOF\n \ttest_cmp expect actual &&\n@@ -106,7 +106,7 @@ test_expect_success \"git-push -f ($PROTOCOL)\" '\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic        Z\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c        Z\n \t> To <URL/of/upstream.git>\n-\t>  + <OID-B>...<OID-A> main -> main (forced update)\n+\t>  + <COMMIT-B>...<COMMIT-A> main -> main (forced update)\n \t>  - [deleted]         next\n \t>  * [new tag]         v123 -> v123\n \t>  * [new reference]   main -> refs/review/main/topic\ndiff --git a/t/t5411/test-0001-standard-git-push--porcelain.sh b/t/t5411/test-0001-standard-git-push--porcelain.sh\nindex 2078d0a027..373ec3d865 100644\n--- a/t/t5411/test-0001-standard-git-push--porcelain.sh\n+++ b/t/t5411/test-0001-standard-git-push--porcelain.sh\n@@ -15,7 +15,7 @@ test_expect_success \"git-push ($PROTOCOL/porcelain)\" '\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/next        Z\n \t> To <URL/of/upstream.git>\n-\t>  \t<COMMIT-B>:refs/heads/main\t<OID-A>..<OID-B>\n+\t>  \t<COMMIT-B>:refs/heads/main\t<COMMIT-A>..<COMMIT-B>\n \t> *\tHEAD:refs/heads/next\t[new branch]\n \t> Done\n \tEOF\n@@ -71,7 +71,7 @@ test_expect_success \"non-fast-forward git-push ($PROTOCOL/porcelain)\" '\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/next        Z\n \t> To <URL/of/upstream.git>\n-\t>  \t<COMMIT-B>:refs/heads/next\t<OID-A>..<OID-B>\n+\t>  \t<COMMIT-B>:refs/heads/next\t<COMMIT-A>..<COMMIT-B>\n \t> !\trefs/heads/main:refs/heads/main\t[rejected] (non-fast-forward)\n \t> Done\n \tEOF\n@@ -109,7 +109,7 @@ test_expect_success \"git-push -f ($PROTOCOL/porcelain)\" '\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/review/main/topic        Z\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/a/b/c        Z\n \t> To <URL/of/upstream.git>\n-\t> +\trefs/heads/main:refs/heads/main\t<OID-B>...<OID-A> (forced update)\n+\t> +\trefs/heads/main:refs/heads/main\t<COMMIT-B>...<COMMIT-A> (forced update)\n \t> -\t:refs/heads/next\t[deleted]\n \t> *\trefs/tags/v123:refs/tags/v123\t[new tag]\n \t> *\trefs/heads/main:refs/review/main/topic\t[new reference]\ndiff --git a/t/t5411/test-0022-report-unexpect-ref.sh b/t/t5411/test-0022-report-unexpect-ref.sh\nindex a2ce7ebdf6..f7a494bdb9 100644\n--- a/t/t5411/test-0022-report-unexpect-ref.sh\n+++ b/t/t5411/test-0022-report-unexpect-ref.sh\n@@ -26,7 +26,7 @@ test_expect_success \"proc-receive: report unexpected ref ($PROTOCOL)\" '\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  <COMMIT-B> -> main\n+\t>    <COMMIT-A>..<COMMIT-B>  <COMMIT-B> -> main\n \t>  ! [remote rejected] HEAD -> refs/for/main/topic (proc-receive failed to report status)\n \tEOF\n \ttest_cmp expect actual &&\ndiff --git a/t/t5411/test-0023-report-unexpect-ref--porcelain.sh b/t/t5411/test-0023-report-unexpect-ref--porcelain.sh\nindex 4e56b163f8..63c479e975 100644\n--- a/t/t5411/test-0023-report-unexpect-ref--porcelain.sh\n+++ b/t/t5411/test-0023-report-unexpect-ref--porcelain.sh\n@@ -26,7 +26,7 @@ test_expect_success \"proc-receive: report unexpected ref ($PROTOCOL/porcelain)\"\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/heads/main        Z\n \t> To <URL/of/upstream.git>\n-\t>  \t<COMMIT-B>:refs/heads/main\t<OID-A>..<OID-B>\n+\t>  \t<COMMIT-B>:refs/heads/main\t<COMMIT-A>..<COMMIT-B>\n \t> !\tHEAD:refs/for/main/topic\t[remote rejected] (proc-receive failed to report status)\n \t> Done\n \tEOF\ndiff --git a/t/t5411/test-0032-report-with-options.sh b/t/t5411/test-0032-report-with-options.sh\nindex cd4f213a7d..988a4302a6 100644\n--- a/t/t5411/test-0032-report-with-options.sh\n+++ b/t/t5411/test-0032-report-with-options.sh\n@@ -123,7 +123,7 @@ test_expect_success \"proc-receive: report option refname and old-oid ($PROTOCOL)\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-B>..<OID-A>  HEAD -> refs/pull/123/head\n+\t>    <COMMIT-B>..<COMMIT-A>  HEAD -> refs/pull/123/head\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -155,7 +155,7 @@ test_expect_success \"proc-receive: report option old-oid ($PROTOCOL)\" '\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-B>..<OID-A>  HEAD -> refs/for/main/topic\n+\t>    <COMMIT-B>..<COMMIT-A>  HEAD -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -189,7 +189,7 @@ test_expect_success \"proc-receive: report option old-oid and new-oid ($PROTOCOL)\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n+\t>    <COMMIT-A>..<COMMIT-B>  HEAD -> refs/for/main/topic\n \tEOF\n \ttest_cmp expect actual\n '\n@@ -243,7 +243,7 @@ test_expect_success \"proc-receive: report with multiple rewrites ($PROTOCOL)\" '\n \t> To <URL/of/upstream.git>\n \t>  * [new reference]   HEAD -> refs/pull/123/head\n \t>  * [new reference]   HEAD -> refs/for/a/b/c/topic\n-\t>  + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)\n+\t>  + <COMMIT-B>...<COMMIT-A> HEAD -> refs/pull/124/head (forced update)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0033-report-with-options--porcelain.sh b/t/t5411/test-0033-report-with-options--porcelain.sh\nindex 7433870e40..daacb3d69d 100644\n--- a/t/t5411/test-0033-report-with-options--porcelain.sh\n+++ b/t/t5411/test-0033-report-with-options--porcelain.sh\n@@ -127,7 +127,7 @@ test_expect_success \"proc-receive: report option refname and old-oid ($PROTOCOL/\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/123/head        Z\n \t> To <URL/of/upstream.git>\n-\t>  \tHEAD:refs/pull/123/head\t<OID-B>..<OID-A>\n+\t>  \tHEAD:refs/pull/123/head\t<COMMIT-B>..<COMMIT-A>\n \t> Done\n \tEOF\n \ttest_cmp expect actual\n@@ -160,7 +160,7 @@ test_expect_success \"proc-receive: report option old-oid ($PROTOCOL/porcelain)\"\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/for/main/topic        Z\n \t> To <URL/of/upstream.git>\n-\t>  \tHEAD:refs/for/main/topic\t<OID-B>..<OID-A>\n+\t>  \tHEAD:refs/for/main/topic\t<COMMIT-B>..<COMMIT-A>\n \t> Done\n \tEOF\n \ttest_cmp expect actual\n@@ -195,7 +195,7 @@ test_expect_success \"proc-receive: report option old-oid and new-oid ($PROTOCOL/\n \t> remote: # post-receive hook        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n \t> To <URL/of/upstream.git>\n-\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n+\t>  \tHEAD:refs/for/main/topic\t<COMMIT-A>..<COMMIT-B>\n \t> Done\n \tEOF\n \ttest_cmp expect actual\n@@ -251,7 +251,7 @@ test_expect_success \"proc-receive: report with multiple rewrites ($PROTOCOL/porc\n \t> To <URL/of/upstream.git>\n \t> *\tHEAD:refs/pull/123/head\t[new reference]\n \t> *\tHEAD:refs/for/a/b/c/topic\t[new reference]\n-\t> +\tHEAD:refs/pull/124/head\t<OID-B>...<OID-A> (forced update)\n+\t> +\tHEAD:refs/pull/124/head\t<COMMIT-B>...<COMMIT-A> (forced update)\n \t> Done\n \tEOF\n \ttest_cmp expect actual &&\ndiff --git a/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh b/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh\nindex e3f456ca5a..8c8a6c16e1 100644\n--- a/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh\n+++ b/t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh\n@@ -60,9 +60,9 @@ test_expect_success \"proc-receive: multiple rewrite for one ref, no refname for\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n+\t>    <COMMIT-A>..<COMMIT-B>  HEAD -> refs/for/main/topic\n \t>  * [new reference]   HEAD -> refs/changes/24/124/1\n-\t>    <OID-A>..<OID-B>  HEAD -> refs/changes/25/125/1\n+\t>    <COMMIT-A>..<COMMIT-B>  HEAD -> refs/changes/25/125/1\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -136,8 +136,8 @@ test_expect_success \"proc-receive: multiple rewrites for one ref, no refname for\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1        Z\n \t> To <URL/of/upstream.git>\n \t>  * [new reference]   HEAD -> refs/changes/24/124/1\n-\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n-\t>  + <OID-B>...<OID-A> HEAD -> refs/changes/25/125/1 (forced update)\n+\t>    <COMMIT-A>..<COMMIT-B>  HEAD -> refs/for/main/topic\n+\t>  + <COMMIT-B>...<COMMIT-A> HEAD -> refs/changes/25/125/1 (forced update)\n \tEOF\n \ttest_cmp expect actual &&\n \n@@ -198,7 +198,7 @@ test_expect_success \"proc-receive: multiple rewrites for one ref ($PROTOCOL)\" '\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2        Z\n \t> To <URL/of/upstream.git>\n \t>  * [new reference]   HEAD -> refs/changes/23/123/1\n-\t>    <OID-A>..<OID-B>  HEAD -> refs/changes/24/124/2\n+\t>    <COMMIT-A>..<COMMIT-B>  HEAD -> refs/changes/24/124/2\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh b/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh\nindex 7786079ba5..bc44810f33 100644\n--- a/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh\n+++ b/t/t5411/test-0037-report-multi-rewrite-for-one-ref--porcelain.sh\n@@ -45,9 +45,9 @@ test_expect_success \"proc-receive: multiple rewrite for one ref, no refname for\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/changes/24/124/1        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/25/125/1        Z\n \t> To <URL/of/upstream.git>\n-\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n+\t>  \tHEAD:refs/for/main/topic\t<COMMIT-A>..<COMMIT-B>\n \t> *\tHEAD:refs/changes/24/124/1\t[new reference]\n-\t>  \tHEAD:refs/changes/25/125/1\t<OID-A>..<OID-B>\n+\t>  \tHEAD:refs/changes/25/125/1\t<COMMIT-A>..<COMMIT-B>\n \t> Done\n \tEOF\n \ttest_cmp expect actual &&\n@@ -107,8 +107,8 @@ test_expect_success \"proc-receive: multiple rewrites for one ref, no refname for\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/changes/25/125/1        Z\n \t> To <URL/of/upstream.git>\n \t> *\tHEAD:refs/changes/24/124/1\t[new reference]\n-\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n-\t> +\tHEAD:refs/changes/25/125/1\t<OID-B>...<OID-A> (forced update)\n+\t>  \tHEAD:refs/for/main/topic\t<COMMIT-A>..<COMMIT-B>\n+\t> +\tHEAD:refs/changes/25/125/1\t<COMMIT-B>...<COMMIT-A> (forced update)\n \t> Done\n \tEOF\n \ttest_cmp expect actual &&\n@@ -155,7 +155,7 @@ test_expect_success \"proc-receive: multiple rewrites for one ref ($PROTOCOL/porc\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/changes/24/124/2        Z\n \t> To <URL/of/upstream.git>\n \t> *\tHEAD:refs/changes/23/123/1\t[new reference]\n-\t>  \tHEAD:refs/changes/24/124/2\t<OID-A>..<OID-B>\n+\t>  \tHEAD:refs/changes/24/124/2\t<COMMIT-A>..<COMMIT-B>\n \t> Done\n \tEOF\n \ttest_cmp expect actual &&\ndiff --git a/t/t5411/test-0038-report-mixed-refs.sh b/t/t5411/test-0038-report-mixed-refs.sh\nindex 0990a3f76a..e63fe7ba11 100644\n--- a/t/t5411/test-0038-report-mixed-refs.sh\n+++ b/t/t5411/test-0038-report-mixed-refs.sh\n@@ -55,12 +55,12 @@ test_expect_success \"proc-receive: report update of mixed refs ($PROTOCOL)\" '\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  <COMMIT-B> -> main\n+\t>    <COMMIT-A>..<COMMIT-B>  <COMMIT-B> -> main\n \t>  * [new branch]      HEAD -> bar\n \t>  * [new branch]      HEAD -> baz\n \t>  * [new reference]   HEAD -> refs/for/next/topic2\n \t>  * [new branch]      HEAD -> foo\n-\t>    <OID-A>..<OID-B>  HEAD -> refs/for/main/topic\n+\t>    <COMMIT-A>..<COMMIT-B>  HEAD -> refs/for/main/topic\n \t>  ! [remote rejected] HEAD -> refs/for/next/topic1 (fail to call Web API)\n \t>  ! [remote rejected] HEAD -> refs/for/next/topic3 (proc-receive failed to report status)\n \tEOF\ndiff --git a/t/t5411/test-0039-report-mixed-refs--porcelain.sh b/t/t5411/test-0039-report-mixed-refs--porcelain.sh\nindex 7e4d08a939..99d17b73af 100644\n--- a/t/t5411/test-0039-report-mixed-refs--porcelain.sh\n+++ b/t/t5411/test-0039-report-mixed-refs--porcelain.sh\n@@ -55,12 +55,12 @@ test_expect_success \"proc-receive: report update of mixed refs ($PROTOCOL/porcel\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/heads/foo        Z\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/for/main/topic        Z\n \t> To <URL/of/upstream.git>\n-\t>  \t<COMMIT-B>:refs/heads/main\t<OID-A>..<OID-B>\n+\t>  \t<COMMIT-B>:refs/heads/main\t<COMMIT-A>..<COMMIT-B>\n \t> *\tHEAD:refs/heads/bar\t[new branch]\n \t> *\tHEAD:refs/heads/baz\t[new branch]\n \t> *\tHEAD:refs/for/next/topic2\t[new reference]\n \t> *\tHEAD:refs/heads/foo\t[new branch]\n-\t>  \tHEAD:refs/for/main/topic\t<OID-A>..<OID-B>\n+\t>  \tHEAD:refs/for/main/topic\t<COMMIT-A>..<COMMIT-B>\n \t> !\tHEAD:refs/for/next/topic1\t[remote rejected] (fail to call Web API)\n \t> !\tHEAD:refs/for/next/topic3\t[remote rejected] (proc-receive failed to report status)\n \t> Done\ndiff --git a/t/t5411/test-0040-process-all-refs.sh b/t/t5411/test-0040-process-all-refs.sh\nindex f67cb2a7b3..2f405adefa 100644\n--- a/t/t5411/test-0040-process-all-refs.sh\n+++ b/t/t5411/test-0040-process-all-refs.sh\n@@ -85,11 +85,11 @@ test_expect_success \"proc-receive: process all refs ($PROTOCOL)\" '\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head        Z\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  <COMMIT-B> -> bar\n+\t>    <COMMIT-A>..<COMMIT-B>  <COMMIT-B> -> bar\n \t>  - [deleted]         foo\n-\t>  + <OID-B>...<OID-A> HEAD -> main (forced update)\n-\t>    <OID-A>..<OID-B>  HEAD -> refs/pull/123/head\n-\t>  + <OID-B>...<OID-A> HEAD -> refs/pull/124/head (forced update)\n+\t>  + <COMMIT-B>...<COMMIT-A> HEAD -> main (forced update)\n+\t>    <COMMIT-A>..<COMMIT-B>  HEAD -> refs/pull/123/head\n+\t>  + <COMMIT-B>...<COMMIT-A> HEAD -> refs/pull/124/head (forced update)\n \tEOF\n \ttest_cmp expect actual &&\n \ndiff --git a/t/t5411/test-0041-process-all-refs--porcelain.sh b/t/t5411/test-0041-process-all-refs--porcelain.sh\nindex 7d1a99d3a2..c88405792e 100644\n--- a/t/t5411/test-0041-process-all-refs--porcelain.sh\n+++ b/t/t5411/test-0041-process-all-refs--porcelain.sh\n@@ -85,11 +85,11 @@ test_expect_success \"proc-receive: process all refs ($PROTOCOL/porcelain)\" '\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head        Z\n \t> remote: post-receive< <COMMIT-B> <COMMIT-A> refs/pull/124/head        Z\n \t> To <URL/of/upstream.git>\n-\t>  \t<COMMIT-B>:refs/heads/bar\t<OID-A>..<OID-B>\n+\t>  \t<COMMIT-B>:refs/heads/bar\t<COMMIT-A>..<COMMIT-B>\n \t> -\t:refs/heads/foo\t[deleted]\n-\t> +\tHEAD:refs/heads/main\t<OID-B>...<OID-A> (forced update)\n-\t>  \tHEAD:refs/pull/123/head\t<OID-A>..<OID-B>\n-\t> +\tHEAD:refs/pull/124/head\t<OID-B>...<OID-A> (forced update)\n+\t> +\tHEAD:refs/heads/main\t<COMMIT-B>...<COMMIT-A> (forced update)\n+\t>  \tHEAD:refs/pull/123/head\t<COMMIT-A>..<COMMIT-B>\n+\t> +\tHEAD:refs/pull/124/head\t<COMMIT-B>...<COMMIT-A> (forced update)\n \t> Done\n \tEOF\n \ttest_cmp expect actual &&\ndiff --git a/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh b/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh\nindex dba544162c..31989f0185 100644\n--- a/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh\n+++ b/t/t5411/test-0050-proc-receive-refs-with-modifiers.sh\n@@ -46,7 +46,7 @@ test_expect_success \"proc-receive: update branch and new tag ($PROTOCOL)\" '\n \t> remote: post-receive< <COMMIT-A> <COMMIT-B> refs/pull/123/head        Z\n \t> remote: post-receive< <ZERO-OID> <TAG-v123> refs/pull/124/head        Z\n \t> To <URL/of/upstream.git>\n-\t>    <OID-A>..<OID-B>  <COMMIT-B> -> refs/pull/123/head\n+\t>    <COMMIT-A>..<COMMIT-B>  <COMMIT-B> -> refs/pull/123/head\n \t>  * [new reference]   v123 -> refs/pull/124/head\n \tEOF\n \ttest_cmp expect actual &&\n@@ -116,7 +116,7 @@ test_expect_success \"proc-receive: create/delete branch, and delete tag ($PROTOC\n \t> remote: post-receive< <ZERO-OID> <COMMIT-A> refs/pull/124/head        Z\n \t> To <URL/of/upstream.git>\n \t>  - [deleted]         refs/pull/123/head\n-\t>    <OID-A>..<OID-B>  <COMMIT-B> -> topic\n+\t>    <COMMIT-A>..<COMMIT-B>  <COMMIT-B> -> topic\n \t>  - [deleted]         v123\n \t>  * [new reference]   <COMMIT-A> -> refs/pull/124/head\n \tEOF\ndiff --git a/t/t5548-push-porcelain.sh b/t/t5548-push-porcelain.sh\nindex c8f18a7a12..f11ff57e54 100755\n--- a/t/t5548-push-porcelain.sh\n+++ b/t/t5548-push-porcelain.sh\n@@ -26,17 +26,27 @@ create_commits_in () {\n \tdone\n }\n \n+get_abbrev_oid () {\n+\toid=$1 &&\n+\tsuffix=${oid#???????} &&\n+\toid=${oid%$suffix} &&\n+\tif test -n \"$oid\"\n+\tthen\n+\t\techo \"$oid\"\n+\telse\n+\t\techo \"undefined-oid\"\n+\tfi\n+}\n+\n # Format the output of git-push, git-show-ref and other commands to make a\n # user-friendly and stable text.  We can easily prepare the expect text\n # without having to worry about future changes of the commit ID and spaces\n # of the output.\n make_user_friendly_and_stable_output () {\n \tsed \\\n-\t\t-e \"s/$A/<COMMIT-A>/g\" \\\n-\t\t-e \"s/$B/<COMMIT-B>/g\" \\\n+\t\t-e \"s/$(get_abbrev_oid $A)[0-9a-f]*/<COMMIT-A>/g\" \\\n+\t\t-e \"s/$(get_abbrev_oid $B)[0-9a-f]*/<COMMIT-B>/g\" \\\n \t\t-e \"s/$ZERO_OID/<ZERO-OID>/g\" \\\n-\t\t-e \"s/$(echo $A | cut -c1-7)[0-9a-f]*/<OID-A>/g\" \\\n-\t\t-e \"s/$(echo $B | cut -c1-7)[0-9a-f]*/<OID-B>/g\" \\\n \t\t-e \"s#To $URL_PREFIX/upstream.git#To <URL/of/upstream.git>#\"\n }\n \n@@ -102,9 +112,9 @@ run_git_push_porcelain_output_test() {\n \t\tformat_and_save_expect <<-EOF &&\n \t\t> To <URL/of/upstream.git>\n \t\t> =\trefs/heads/baz:refs/heads/baz\t[up to date]\n-\t\t>  \t<COMMIT-B>:refs/heads/bar\t<OID-A>..<OID-B>\n+\t\t>  \t<COMMIT-B>:refs/heads/bar\t<COMMIT-A>..<COMMIT-B>\n \t\t> -\t:refs/heads/foo\t[deleted]\n-\t\t> +\trefs/heads/main:refs/heads/main\t<OID-B>...<OID-A> (forced update)\n+\t\t> +\trefs/heads/main:refs/heads/main\t<COMMIT-B>...<COMMIT-A> (forced update)\n \t\t> *\trefs/heads/next:refs/heads/next\t[new branch]\n \t\t> Done\n \t\tEOF\n@@ -220,7 +230,7 @@ run_git_push_porcelain_output_test() {\n \t\tTo <URL/of/upstream.git>\n \t\t> =\trefs/heads/next:refs/heads/next\t[up to date]\n \t\t> -\t:refs/heads/baz\t[deleted]\n-\t\t>  \trefs/heads/main:refs/heads/main\t<OID-A>..<OID-B>\n+\t\t>  \trefs/heads/main:refs/heads/main\t<COMMIT-A>..<COMMIT-B>\n \t\t> !\trefs/heads/bar:refs/heads/bar\t[rejected] (non-fast-forward)\n \t\tDone\n \t\tEOF\n-- \n2.32.0.rc0.27.g7b1e85181b\n\n"}]}