3 test_description
='git archive --format=zip test'
9 test_lazy_prereq UNZIP_SYMLINKS
'
11 mkdir unzip-symlinks &&
13 "$GIT_UNZIP" "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip &&
22 dir_with_prefix
=$dir/$2
24 test_expect_success UNZIP
" extract ZIP archive" '
25 (mkdir $dir && cd $dir && "$GIT_UNZIP" ../$zipfile)
28 test_expect_success UNZIP
" validate filenames" "
29 (cd ${dir_with_prefix}a && find .) | sort >$listfile &&
30 test_cmp a.lst $listfile
33 test_expect_success UNZIP
" validate file contents" "
34 diff -r a ${dir_with_prefix}a
41 echo simple textfile >a/a &&
44 printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
45 printf "A not substituted O" >a/substfile2 &&
46 (p=long_path_to_a_file && cd a &&
47 for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&
48 echo text >file_with_long_path)
51 test_expect_success SYMLINKS
,UNZIP_SYMLINKS
'add symlink' '
52 ln -s a a/symlink_to_a
55 test_expect_success
'prepare file list' '
56 (cd a && find .) | sort >a.lst
61 'echo ignore me >a/ignored &&
62 echo ignored export-ignore >.git/info/attributes'
65 'add files to repository' \
66 'find a -type f | xargs git update-index --add &&
67 find a -type l | xargs git update-index --add &&
68 treeid=`git write-tree` &&
69 echo $treeid >treeid &&
70 git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
71 git commit-tree $treeid </dev/null)'
75 'git clone --bare . bare.git &&
76 cp .git/info/attributes bare.git/info/attributes'
79 'remove ignored file' \
83 'git archive --format=zip' \
84 'git archive --format=zip HEAD >d.zip'
89 'git archive --format=zip in a bare repo' \
90 '(cd bare.git && git archive --format=zip HEAD) >d1.zip'
93 'git archive --format=zip vs. the same in a bare repo' \
94 'test_cmp d.zip d1.zip'
96 test_expect_success
'git archive --format=zip with --output' \
97 'git archive --format=zip --output=d2.zip HEAD &&
98 test_cmp d.zip d2.zip'
100 test_expect_success
'git archive with --output, inferring format' '
101 git archive --output=d3.zip HEAD &&
102 test_cmp d.zip d3.zip
105 test_expect_success \
106 'git archive --format=zip with prefix' \
107 'git archive --format=zip --prefix=prefix/ HEAD >e.zip'
111 test_expect_success
'git archive -0 --format=zip on large files' '
112 test_config core.bigfilethreshold 1 &&
113 git archive -0 --format=zip HEAD >large.zip
118 test_expect_success
'git archive --format=zip on large files' '
119 test_config core.bigfilethreshold 1 &&
120 git archive --format=zip HEAD >large-compressed.zip
123 check_zip large-compressed