convert: stream from fd to required clean filter instead of mmap
commitd917aa5500224bc52d386b1e5adfb8eb294106a9
authorSteffen Prohaska <prohaska@zib.de>
Fri, 22 Aug 2014 14:01:23 +0000 (22 16:01 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Aug 2014 18:16:26 +0000 (22 11:16 -0700)
tree18e657eb43433a0a78ae4cf177e50b94c590db95
parent37f77acf1ff2900b86cf48a05da2d5ef15e84015
convert: stream from fd to required clean filter instead of mmap

The data is streamed to the filter process anyway.  Better avoid
mapping the file if possible.  This is especially useful if a clean
filter reduces the size, for example if it computes a sha1 for
binary data, like git media.  The file size that the previous
implementation could handle was limited by the available address
space; large files for example could not be handled with (32-bit)
msysgit.  The new implementation can filter files of any size as
long as the filter output is small enough.

The new code path is only taken if the filter is required.  The
filter consumes data directly from the fd.  The original data is not
available to git, so it must fail if the filter fails.

The environment variable GIT_MMAP_LIMIT is used to test that the
expected code path is taken.  A related test that exercises required
filters is modified to verify that the data actually has been
modified on its way from the file system to the object store.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c
convert.h
sha1_file.c
t/t0021-conversion.sh