Skip to content

Commit dba38ca

Browse files
vtbassmattGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
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>
1 parent c4e9e94 commit dba38ca

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

t/t1051-large-conversion.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,15 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
109109
test $(test_file_size big) -eq $(cat big.size)
110110
'
111111

112+
# This clean filter writes down the size of input it receives. By checking against
113+
# the actual size, we ensure that cleaning doesn't mangle large files on 64-bit Windows.
114+
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \
115+
'files over 4GB convert on input' '
116+
test-tool genzeros $((5*1024*1024*1024)) >big &&
117+
test_config filter.checklarge.clean "wc -c >big.size" &&
118+
echo "big filter=checklarge" >.gitattributes &&
119+
git add big &&
120+
test $(test_file_size big) -eq $(cat big.size)
121+
'
122+
112123
test_done

0 commit comments

Comments
 (0)