提交 7d2726c3 编写于 作者: J Junio C Hamano

Merge branch 'rs/zip-compresssed-size-with-export-subst' into maint

When export-subst is used, "zip" output recorded incorrect
size of the file.

* rs/zip-compresssed-size-with-export-subst:
  archive-zip: fix compressed size for stored export-subst files
...@@ -240,7 +240,6 @@ static int write_zip_entry(struct archiver_args *args, ...@@ -240,7 +240,6 @@ static int write_zip_entry(struct archiver_args *args,
(mode & 0111) ? ((mode) << 16) : 0; (mode & 0111) ? ((mode) << 16) : 0;
if (S_ISREG(mode) && args->compression_level != 0 && size > 0) if (S_ISREG(mode) && args->compression_level != 0 && size > 0)
method = 8; method = 8;
compressed_size = (method == 0) ? size : 0;
if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert && if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
size > big_file_threshold) { size > big_file_threshold) {
...@@ -259,6 +258,7 @@ static int write_zip_entry(struct archiver_args *args, ...@@ -259,6 +258,7 @@ static int write_zip_entry(struct archiver_args *args,
crc = crc32(crc, buffer, size); crc = crc32(crc, buffer, size);
out = buffer; out = buffer;
} }
compressed_size = (method == 0) ? size : 0;
} else { } else {
return error("unsupported file mode: 0%o (SHA1: %s)", mode, return error("unsupported file mode: 0%o (SHA1: %s)", mode,
sha1_to_hex(sha1)); sha1_to_hex(sha1));
......
...@@ -76,6 +76,12 @@ test_expect_success \ ...@@ -76,6 +76,12 @@ test_expect_success \
git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \ git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
git commit-tree $treeid </dev/null)' git commit-tree $treeid </dev/null)'
test_expect_success 'setup export-subst' '
echo "substfile?" export-subst >>.git/info/attributes &&
git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
>a/substfile1
'
test_expect_success \ test_expect_success \
'create bare clone' \ 'create bare clone' \
'git clone --bare . bare.git && 'git clone --bare . bare.git &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册