Skip to content

Commit 7d2726c

Browse files
committed
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
2 parents d7cccbb + d3c1472 commit 7d2726c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

archive-zip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ static int write_zip_entry(struct archiver_args *args,
240240
(mode & 0111) ? ((mode) << 16) : 0;
241241
if (S_ISREG(mode) && args->compression_level != 0 && size > 0)
242242
method = 8;
243-
compressed_size = (method == 0) ? size : 0;
244243

245244
if (S_ISREG(mode) && type == OBJ_BLOB && !args->convert &&
246245
size > big_file_threshold) {
@@ -259,6 +258,7 @@ static int write_zip_entry(struct archiver_args *args,
259258
crc = crc32(crc, buffer, size);
260259
out = buffer;
261260
}
261+
compressed_size = (method == 0) ? size : 0;
262262
} else {
263263
return error("unsupported file mode: 0%o (SHA1: %s)", mode,
264264
sha1_to_hex(sha1));

t/t5003-archive-zip.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ test_expect_success \
7676
git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
7777
git commit-tree $treeid </dev/null)'
7878

79+
test_expect_success 'setup export-subst' '
80+
echo "substfile?" export-subst >>.git/info/attributes &&
81+
git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
82+
>a/substfile1
83+
'
84+
7985
test_expect_success \
8086
'create bare clone' \
8187
'git clone --bare . bare.git &&

0 commit comments

Comments
 (0)