git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 09/10] t5551: stop writing packed-refs directly
Date: Wed, 29 Nov 2023 17:26:10 -0500	[thread overview]
Message-ID: <ZWe6goJHliFZrOAZ@nand.local> (raw)
In-Reply-To: <2ab24ea5633be6b4855567d126a184d54c624f62.1701242407.git.ps@pks.im>

On Wed, Nov 29, 2023 at 08:25:14AM +0100, Patrick Steinhardt wrote:
> We have multiple tests in t5551 that write thousands of tags. To do so
> efficiently we generate the tags by writing the `packed-refs` file
> directly, which of course assumes that the reference database is backed
> by the files backend.
>
> Refactor the code to instead use a single `git update-ref --stdin`
> command to write the tags. While the on-disk end result is not the same
> as we now have a bunch of loose refs instead of a single packed-refs
> file, the distinction shouldn't really matter for any of the tests that
> use this helper.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  t/t5551-http-fetch-smart.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
> index 8a41adf1e1..e069737b80 100755
> --- a/t/t5551-http-fetch-smart.sh
> +++ b/t/t5551-http-fetch-smart.sh
> @@ -359,7 +359,9 @@ create_tags () {
>
>  	# now assign tags to all the dangling commits we created above
>  	tag=$(perl -e "print \"bla\" x 30") &&
> -	sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
> +	sed -e "s|^:\([^ ]*\) \(.*\)$|create refs/tags/$tag-\1 \2|" <marks >input &&
> +	git update-ref --stdin <input &&
> +	rm input

Same note here as in the previous patch, although here I think we'd
prefer to pipe from sed to git update-ref directly, rather than writing
an intermediate file which we have to clean up afterwords.

Thanks,
Taylor

  reply	other threads:[~2023-11-29 22:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  7:24 [PATCH 00/10] t: more compatibility fixes with reftables Patrick Steinhardt
2023-11-29  7:24 ` [PATCH 01/10] t0410: mark tests to require the reffiles backend Patrick Steinhardt
2023-11-29 22:19   ` Taylor Blau
2023-11-29  7:24 ` [PATCH 02/10] t1400: split up generic reflog tests from the reffile-specific ones Patrick Steinhardt
2023-11-29  7:24 ` [PATCH 03/10] t1401: stop treating FETCH_HEAD as real reference Patrick Steinhardt
2023-11-29  7:24 ` [PATCH 04/10] t1410: use test-tool to create empty reflog Patrick Steinhardt
2023-11-29  7:24 ` [PATCH 05/10] t1417: make `reflog --updateref` tests backend agnostic Patrick Steinhardt
2023-11-29  7:25 ` [PATCH 06/10] t3310: stop checking for reference existence via `test -f` Patrick Steinhardt
2023-11-29  7:25 ` [PATCH 07/10] t4013: simplify magic parsing and drop "failure" Patrick Steinhardt
2023-11-29  7:25 ` [PATCH 08/10] t5401: speed up creation of many branches Patrick Steinhardt
2023-11-29 22:25   ` Taylor Blau
2023-11-29  7:25 ` [PATCH 09/10] t5551: stop writing packed-refs directly Patrick Steinhardt
2023-11-29 22:26   ` Taylor Blau [this message]
2023-11-29  7:25 ` [PATCH 10/10] t6301: write invalid object ID via `test-tool ref-store` Patrick Steinhardt
2023-11-29 23:30 ` [PATCH 00/10] t: more compatibility fixes with reftables Taylor Blau
2023-11-30  7:06   ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWe6goJHliFZrOAZ@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).