Subject: Re: [PATCH v4 1/2] t1092: add tests for `git diff-files`

From: Junio C Hamano <[email-masked]>
Date: Thu, 09 Mar 2023 15:40:59 -0800

Shuqi Liang <[email-masked]> writes:

> I wonder if the method below is good  to test the actual output for '
> file present on-disk with modifications' :
>
>     cat >expect  <<-EOF &&
>     :100644 100644 8e27be7d6154a1f68ea9160ef0e18691d20560dc
> 0000000000000000000000000000000000000000 M newdirectory/testfile
>     EOF

Hardcoding 8e27be assumes we only support SHA-1 but there is a CI
test job that runs everything in SHA-256 mode, so it is likely
to break if you wrote it like so.  Something along the lines of ...

	FN=newdirectory/testfile &&
	OID=$(git hash-object $FN) &&
	ZERO=$(test_oid zero) &&
	echo ":100644 100644 $OID $ZERO M new $FN" >expect

... may have a better chance to be correct, but I didn't test ;-)