From: Junio C Hamano Date: Thu, 09 Mar 2023 23:40:59 GMT Subject: Re: [PATCH v4 1/2] t1092: add tests for `git diff-files` Message-ID: In-Reply-To: Shuqi Liang 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 ;-)