Subject: Re: [PATCH v5 5/6] last-modified: support --extended format

From: Junio C Hamano <[email-masked]>
Date: Fri, 18 Jul 2025 10:36:06 -0700

Junio C Hamano <[email-masked]> writes:

> Hmph.  This hardcoding of everything does not look easy to maintain.
>
> Besides, the test will fail rather miserably when run with SHA-256
> hash (e.g., post Git 3.0 where the "git init" command by default
> will give you a repository with new hash).
>
> It looks somewhat inconsistent that tree is shown with its object
> name, but commit is not.

I do not address neither the first point or the last point above,
but at least something like the attached patch needs to be squashed
into this step to make the SHA-256 tests pass.

Thanks.

commit 86a64ae7a4b866db0f17f906ca5be95333d907ab
Author: Junio C Hamano <[email-masked]>
Date:   Fri Jul 18 10:33:58 2025 -0700

    fixup! last-modified: support --extended format

diff --git a/t/t8020-last-modified.sh b/t/t8020-last-modified.sh
index 008ea708ab..e737cb2505 100755
--- a/t/t8020-last-modified.sh
+++ b/t/t8020-last-modified.sh
@@ -6,10 +6,12 @@ test_description='last-modified tests'
 
 test_expect_success 'setup' '
 	test_commit 1 file &&
+	TREE1=$(git rev-parse HEAD^{tree}) &&
 	mkdir a &&
 	test_commit 2 a/file &&
 	mkdir a/b &&
-	test_commit 3 a/b/file
+	test_commit 3 a/b/file &&
+	TREE3=$(git rev-parse HEAD^{tree})
 '
 
 test_expect_success 'cannot run last-modified on two trees' '
@@ -49,10 +51,10 @@ test_expect_success 'last-modified non-recursive' '
 '
 
 test_expect_success 'last-modified extended output' '
-	check_last_modified --extended <<-\EOF
+	check_last_modified --extended <<-EOF
 	path a
 	commit 3
-	tree e9a947598482012e54c9c5d3635d5b526b43a6a4
+	tree $TREE3
 	parent 2
 	author A U Thor <[email-masked]> 1112912113 -0700
 	committer C O Mitter <[email-masked]> 1112912113 -0700
@@ -61,7 +63,7 @@ test_expect_success 'last-modified extended output' '
 
 	path file
 	commit 1
-	tree f27c6ae26adb8396d3861976ba268f87ad8afa0b
+	tree $TREE1
 	author A U Thor <[email-masked]> 1112911993 -0700
 	committer C O Mitter <[email-masked]> 1112911993 -0700