Re: [PATCH] t5319: don't trip over a user name with whitespace
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jun 30, 2019, 19:48 UTC
- Message-ID
- <CAPig+cRpOHRgtCXXiqAZtmEtkWnMy7=4GsTVv0XB9R3fF0-66A@mail.gmail.com>
- In-Reply-To
- <d4a3f56b-5eaa-1325-f8c1-be6797a9ac03@kdbg.org>
On Sun, Jun 30, 2019 at 2:57 PM Johannes Sixt <j6t@kdbg.org> wrote:
Show 16 quoted lines
> On my Windows system where the POSIX commands are provided by MSYS2,
> I observe this output:
>
> $ ls -l Makefile
> -rw-r--r-- 1 Johannes Sixt 197121 101780 Jun 30 09:33 Makefile
>
> Notice the blank in the user name. Obviously, extracting the size
> of a file by counting columns won't work. But two tests in t5319
> do that. Use the stat command to print just the file size.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
> diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
> @@ -443,7 +443,7 @@ test_expect_success 'repack with minimum size does not alter existing packs' '
> - MINSIZE=$(ls -l .git/objects/pack/*pack | awk "{print \$5;}" | sort -n | head -n 1) &&
> + MINSIZE=$(stat -c %s .git/objects/pack/*pack | sort -n | head -n 1) &&Unfortunately, this is not portable. While "stat -c %s" works on Linux and MSYS2, neither that option nor the format directive are recognized on BSD-like platforms (I tested Mac OS and FreeBSD), which instead need "stat -f %z".