diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2013-02-27 11:20:21 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-02-27 07:38:32 -0800 |
commit | d3c1472fe35e2575508d80415565822ee2211df5 (patch) | |
tree | fb824ed2d196f643f2847683b5c6cf134b07be3b /remote-curl.c | |
parent | Merge branch 'rs/zip-with-uncompressed-size-in-the-header' (diff) | |
download | tgif-d3c1472fe35e2575508d80415565822ee2211df5.tar.xz |
archive-zip: fix compressed size for stored export-subst files
Currently ZIP archive entries of files with export-subst attribute are
broken if they are stored uncompressed.
We get the size of a file from sha1_object_info(), but this number is
likely wrong for files whose contents are changed due to export-subst
placeholder expansion. We use sha1_file_to_archive() to get the
expanded file contents and size in that case. We proceed to use that
size for the uncompressed size field (good), but the compressed size
field is set based on the size from sha1_object_info() (bad).
This matters only for uncompressed files because for deflated files
we use the correct value after compression is done. And for files
without export-subst expansion the sizes from sha1_object_info() and
sha1_file_to_archive() are the same, so they are unaffected as well.
This patch fixes the issue by setting the compressed size based on the
uncompressed size only after we actually know the latter.
Also make use of the test file substfile1 to check for the breakage;
it was only stored verbatim so far. For that purpose, set the
attribute export-subst and replace its contents with the expected
expansion after committing.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
0 files changed, 0 insertions, 0 deletions