Subject: Re: [PATCH v2 7/8] repack: honor `-l` when calculating pack geometry

From: Junio C Hamano <[email-masked]>
Date: Wed, 12 Apr 2023 16:56:29 -0700

Patrick Steinhardt <[email-masked]> writes:

> +	# Note that we are using stat(1) to verify idempotence to also verify
> +	# that the mtime did not change. This is done in order to detect the
> +	# case where we do repack objects, but the resulting packfile is the
> +	# same.
> +	stat member/.git/objects/pack/* >expected-member-packs &&
> +	git -C member repack --geometric=2 -l -d &&
> +	stat member/.git/objects/pack/* >actual-member-packs &&

These tests that use stat(1) are very likely to be non-portable.

Worse yet, even when stat(1) is available, when running

    $ cd t && sh t7703-repack-geometric.sh --root=/dev/shm/testpen -i -v

in my environment (based on Debian), the lists fail to match at
subseconds.

--- expected-member-packs       2023-04-12 23:48:52.817035290 +0000
+++ actual-member-packs 2023-04-12 23:48:52.833036370 +0000
@@ -2,7 +2,7 @@
   Size: 1156           Blocks: 8          IO Block: 4096   regular file
 Device: 0,25   Inode: 2330515     Links: 1
 Access: (0400/-r--------)  Uid: (1001/   gitster)   Gid: (1001/gitster)
-Access: 2023-04-12 23:48:52.801034210 +0000
+Access: 2023-04-12 23:48:52.829036100 +0000
 Modify: 2023-04-12 23:48:52.773032320 +0000
 Change: 2023-04-12 23:48:52.773032320 +0000
  Birth: 2023-04-12 23:48:52.773032320 +0000
@@ -10,7 +10,7 @@
   Size: 276            Blocks: 8          IO Block: 4096   regular file
 Device: 0,25   Inode: 2330514     Links: 1
 Access: (0400/-r--------)  Uid: (1001/   gitster)   Gid: (1001/gitster)
-Access: 2023-04-12 23:48:52.781032860 +0000
+Access: 2023-04-12 23:48:52.829036100 +0000
 Modify: 2023-04-12 23:48:52.773032320 +0000
 Change: 2023-04-12 23:48:52.773032320 +0000
  Birth: 2023-04-12 23:48:52.769032050 +0000