git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t7703: ignore 'total' line when comparing ls -l output

From
Patrick Steinhardt <ps@pks.im>
Date
May 5, 2026, 06:02 UTC
Message-ID
<afmIAxNKOlRCxwKn@pks.im>
In-Reply-To
<20260504101429.340123-1-joerg@thalheim.io>
On Mon, May 04, 2026 at 12:14:29PM +0200, Joerg Thalheim wrote:
Show 27 quoted lines
> diff --git a/t/t7703-repack-geometric.sh b/t/t7703-repack-geometric.sh
> index 04d5d8fc33..9b5a428620 100755
> --- a/t/t7703-repack-geometric.sh
> +++ b/t/t7703-repack-geometric.sh
> @@ -299,9 +299,9 @@ test_expect_success '--geometric --write-midx retains up-to-date MIDX without bi
>  		test_path_is_file .git/objects/pack/multi-pack-index &&
>  		test-tool chmtime =0 .git/objects/pack/multi-pack-index &&
>  
> -		ls -l .git/objects/pack/ >expect &&
> +		ls -l .git/objects/pack/ | sed 1d >expect &&
>  		git repack --geometric=2 --write-midx --no-write-bitmap-index &&
> -		ls -l .git/objects/pack/ >actual &&
> +		ls -l .git/objects/pack/ | sed 1d >actual &&
>  		test_cmp expect actual
>  	)
>  '
> @@ -316,9 +316,9 @@ test_expect_success '--geometric --write-midx retains up-to-date MIDX with bitma
>  	test_path_is_file repo/.git/objects/pack/multi-pack-index &&
>  	test-tool chmtime =0 repo/.git/objects/pack/multi-pack-index &&
>  
> -	ls -l repo/.git/objects/pack/ >expect &&
> +	ls -l repo/.git/objects/pack/ | sed 1d >expect &&
>  	git -C repo repack --geometric=2 --write-midx --write-bitmap-index &&
> -	ls -l repo/.git/objects/pack/ >actual &&
> +	ls -l repo/.git/objects/pack/ | sed 1d >actual &&
>  	test_cmp expect actual
>  '

Hm. So all we're interested in is the mtime of these files as an indicator whether they have been rewritten or not. I don't think there's an easy, portable via POSIX tooling to retrieve that. But we don't need it, because our test-tool already supports this functionality:

    $ test-tool chmtime --get <files>
So how about we do the below patch instead?
Thanks!
Patrick
diff --git a/t/t7703-repack-geometric.sh b/t/t7703-repack-geometric.sh
index 04d5d8fc33..ec7032bf5d 100755
--- a/t/t7703-repack-geometric.sh
+++ b/t/t7703-repack-geometric.sh
@@ -299,9 +299,9 @@ test_expect_success '--geometric --write-midx retains up-to-date MIDX without bi
 		test_path_is_file .git/objects/pack/multi-pack-index &&
 		test-tool chmtime =0 .git/objects/pack/multi-pack-index &&
 
-		ls -l .git/objects/pack/ >expect &&
+		test-tool chmtime --get .git/objects/pack/* >expect &&
 		git repack --geometric=2 --write-midx --no-write-bitmap-index &&
-		ls -l .git/objects/pack/ >actual &&
+		test-tool chmtime --get .git/objects/pack/* >actual &&
 		test_cmp expect actual
 	)
 '
@@ -316,9 +316,9 @@ test_expect_success '--geometric --write-midx retains up-to-date MIDX with bitma
 	test_path_is_file repo/.git/objects/pack/multi-pack-index &&
 	test-tool chmtime =0 repo/.git/objects/pack/multi-pack-index &&
 
-	ls -l repo/.git/objects/pack/ >expect &&
+	test-tool chmtime --get repo/.git/objects/pack/* >expect &&
 	git -C repo repack --geometric=2 --write-midx --write-bitmap-index &&
-	ls -l repo/.git/objects/pack/ >actual &&
+	test-tool chmtime --get repo/.git/objects/pack/* >actual &&
 	test_cmp expect actual
 '
Previous: Joerg Thalheim
Message 2 of 2 in “t7703: ignore 'total' line when comparing ls -l output”
  1. t7703: ignore 'total' line when comparing ls -l outputJoerg Thalheim, May 4, 2026
  2. Patrick SteinhardtMay 5, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.