On Sun, Jun 30, 2019 at 2:57 PM Johannes Sixt <j...@kdbg.org> wrote:
> 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 <j...@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".

Reply via email to