t/t-smudge.sh: test smudge spooling to temp file

In a prior commit in this PR we updated the tools.Spool() function,
which is used only by the "git lfs smudge" command and only when it
must pass through non-pointer data.  When this data is longer than
the default internal memory buffer of 1024 bytes, the Spool() function
creates a temporary file to buffer the data, and then defers an
os.Remove() call to delete the file when the operation is complete.

At present this use of a temporary file when spooling is not tested by
the t/t-smudge.sh test suite, so we add a check in the existing "smudge
with invalid pointer" test which forces the use of such a file by
sending more than 1024 bytes of non-pointer data.
This commit is contained in:
Chris Darroch 2024-01-14 22:31:58 -08:00
parent c40eca710a
commit 01e28e13fb

@ -54,6 +54,10 @@ begin_test "smudge with invalid pointer"
[ "wat" = "$(echo "wat" | git lfs smudge)" ]
[ "not a git-lfs file" = "$(echo "not a git-lfs file" | git lfs smudge)" ]
[ "version " = "$(echo "version " | git lfs smudge)" ]
# force use of a spool file with non-pointer input longer than max buffer
spool="$(base64 < /dev/urandom | head -c 2048)"
[ "$spool" = "$(echo "$spool" | git lfs smudge)" ]
)
end_test