summaryrefslogtreecommitdiff
path: root/t/t1051-large-conversion.sh
diff options
context:
space:
mode:
authorMatt Cooper <vtbassmatt@gmail.com>2021-11-02 15:46:11 +0000
committerJunio C Hamano <gitster@pobox.com>2021-11-03 11:22:27 -0700
commit596b5e77c960cc57ad2e68407b298411ec5e8cb8 (patch)
tree1f43d3d1956e3a0866cf2c57761e92404fbad8e5 /t/t1051-large-conversion.sh
parentd6a09e795d77ddc76c5141047340dc3cb62355f4 (diff)
downloadgit-596b5e77c960cc57ad2e68407b298411ec5e8cb8.tar.gz
clean/smudge: allow clean filters to process extremely large files
The filter system allows for alterations to file contents when they're moved between the database and the worktree. We already made sure that it is possible for smudge filters to produce contents that are larger than `unsigned long` can represent (which matters on systems where `unsigned long` is narrower than `size_t`, most notably 64-bit Windows). Now we make sure that clean filters can _consume_ contents that are larger than that. Note that this commit only allows clean filters' _input_ to be larger than can be represented by `unsigned long`. This change makes only a very minute dent into the much larger project to teach Git to use `size_t` instead of `unsigned long` wherever appropriate. Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Matt Cooper <vtbassmatt@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1051-large-conversion.sh')
-rwxr-xr-xt/t1051-large-conversion.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t1051-large-conversion.sh b/t/t1051-large-conversion.sh
index e6d52f98b1..042b0e4429 100755
--- a/t/t1051-large-conversion.sh
+++ b/t/t1051-large-conversion.sh
@@ -98,4 +98,15 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
test "$size" -eq $((5 * 1024 * 1024 * 1024 + $small_size))
'
+# This clean filter writes down the size of input it receives. By checking against
+# the actual size, we ensure that cleaning doesn't mangle large files on 64-bit Windows.
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
+ 'files over 4GB convert on input' '
+ test-tool genzeros $((5*1024*1024*1024)) >big &&
+ test_config filter.checklarge.clean "wc -c >big.size" &&
+ echo "big filter=checklarge" >.gitattributes &&
+ git add big &&
+ test $(test_file_size big) -eq $(cat big.size)
+'
+
test_done