From: Derrick Stolee <stolee@gmail.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>, "Jeff King" <peff@peff.net>
Cc: "Johannes Sixt" <j6t@kdbg.org>,
"Eric Sunshine" <sunshine@sunshineco.com>,
"Git List" <git@vger.kernel.org>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Jonathan Tan" <jonathantanmy@google.com>,
"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] t5319: don't trip over a user name with whitespace
Date: Mon, 1 Jul 2019 08:03:15 -0400 [thread overview]
Message-ID: <100c5c85-59b6-f68c-7da6-b05637534858@gmail.com> (raw)
In-Reply-To: <20190701113304.GK21574@szeder.dev>
Sorry I'm late to the thread. Thanks for reporting this issue, Johannes.
On 7/1/2019 7:33 AM, SZEDER Gábor wrote:
> On Mon, Jul 01, 2019 at 05:16:02AM -0400, Jeff King wrote:
>> I see Gábor suggested using "wc -c" elsewhere in the thread. That would
>> be fine with me, too, though I think the required sed there may be
>> getting pretty unreadable, too. :)
>
> It could be done even without 'sed', though at the expense of running
> a coupe more 'wc -c's in a loop:>
> diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
> index 79bfaeafa9..bacec5e2e4 100755
> --- a/t/t5319-multi-pack-index.sh
> +++ b/t/t5319-multi-pack-index.sh
> @@ -443,7 +443,12 @@ test_expect_success 'repack with minimum size does not alter existing packs' '
> touch -m -t 201901010002 .git/objects/pack/pack-B* &&
> touch -m -t 201901010003 .git/objects/pack/pack-A* &&
> ls .git/objects/pack >expect &&
> - MINSIZE=$(ls -l .git/objects/pack/*pack | awk "{print \$5;}" | sort -n | head -n 1) &&
> + MINSIZE=$(
> + for pack in .git/objects/pack/*pack
> + do
> + wc -c <"$pack"
> + done | sort -n | head -n 1
> + ) &&
> git multi-pack-index repack --batch-size=$MINSIZE &&
> ls .git/objects/pack >actual &&
> test_cmp expect actual
> @@ -455,7 +460,12 @@ test_expect_success 'repack creates a new pack' '
> cd dup &&
> ls .git/objects/pack/*idx >idx-list &&
> test_line_count = 5 idx-list &&
> - THIRD_SMALLEST_SIZE=$(ls -l .git/objects/pack/*pack | awk "{print \$5;}" | sort -n | head -n 3 | tail -n 1) &&
> + THIRD_SMALLEST_SIZE=$(
> + for pack in .git/objects/pack/*pack
> + do
> + wc -c <"$pack"
> + done | sort -n | head -n 3 | tail -n 1
> + ) &&
> BATCH_SIZE=$(($THIRD_SMALLEST_SIZE + 1)) &&
> git multi-pack-index repack --batch-size=$BATCH_SIZE &&
> ls .git/objects/pack/*idx >idx-list &&
>
> Is it really better? Dunno, but at least there is no subtlety with
> the leading padding spaces.
Your change is certainly more straight-forward, and avoids all issues
around Perl compatibility.
It does have the issue of more 'wc' processes, which is a downside. The
count here is not too bad, but if we need to duplicate this pattern elsewhere
we may be better off creating a stat(1) replacement in test-lib.sh.
Thanks,
-Stolee
next prev parent reply other threads:[~2019-07-01 12:03 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 23:35 [PATCH 00/11] Create 'expire' and 'repack' verbs for git-multi-pack-index Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 01/11] repack: refactor pack deletion for future use Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 02/11] Docs: rearrange subcommands for multi-pack-index Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 03/11] multi-pack-index: prepare for 'expire' subcommand Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 05/11] midx: refactor permutation logic and pack sorting Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 04/11] midx: simplify computation of pack name lengths Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 06/11] multi-pack-index: implement 'expire' subcommand Derrick Stolee via GitGitGadget
2019-06-11 18:51 ` Junio C Hamano
2019-06-10 23:35 ` [PATCH 07/11] multi-pack-index: prepare 'repack' subcommand Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 08/11] midx: implement midx_repack() Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 09/11] multi-pack-index: test expire while adding packs Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 10/11] midx: add test that 'expire' respects .keep files Derrick Stolee via GitGitGadget
2019-06-10 23:35 ` [PATCH 11/11] t5319-multi-pack-index.sh: test batch size zero Derrick Stolee via GitGitGadget
2019-06-30 18:57 ` [PATCH] t5319: don't trip over a user name with whitespace Johannes Sixt
2019-06-30 19:48 ` Eric Sunshine
2019-06-30 20:59 ` Johannes Sixt
2019-06-30 22:25 ` Jeff King
2019-07-01 6:33 ` Johannes Sixt
2019-07-01 9:16 ` Jeff King
2019-07-01 11:33 ` SZEDER Gábor
2019-07-01 12:03 ` Derrick Stolee [this message]
2019-07-01 12:11 ` Johannes Schindelin
2019-07-01 12:30 ` Derrick Stolee
2019-07-01 18:22 ` Johannes Sixt
2019-07-01 18:47 ` Derrick Stolee
2019-07-01 12:53 ` Jeff King
2019-07-01 8:36 ` SZEDER Gábor
2019-07-01 17:17 ` Andreas Schwab
2019-07-01 19:24 ` Junio C Hamano
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=100c5c85-59b6-f68c-7da6-b05637534858@gmail.com \
--to=stolee@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=jonathantanmy@google.com \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
--cc=szeder.dev@gmail.com \
/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).