3 test_description
='git archive --format=zip test'
6 GIT_UNZIP
=${GIT_UNZIP:-unzip}
10 test_lazy_prereq UNZIP
'
15 test_lazy_prereq UNZIP_SYMLINKS
'
17 mkdir unzip-symlinks &&
19 "$GIT_UNZIP" "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip &&
28 dir_with_prefix
=$dir/$2
30 test_expect_success UNZIP
" extract ZIP archive" '
31 (mkdir $dir && cd $dir && "$GIT_UNZIP" ../$zipfile)
34 test_expect_success UNZIP
" validate filenames" "
35 (cd ${dir_with_prefix}a && find .) | sort >$listfile &&
36 test_cmp a.lst $listfile
39 test_expect_success UNZIP
" validate file contents" "
40 diff -r a ${dir_with_prefix}a
47 echo simple textfile >a/a &&
50 printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
51 printf "A not substituted O" >a/substfile2 &&
52 (p=long_path_to_a_file && cd a &&
53 for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&
54 echo text >file_with_long_path)
57 test_expect_success SYMLINKS
,UNZIP_SYMLINKS
'add symlink' '
58 ln -s a a/symlink_to_a
61 test_expect_success
'prepare file list' '
62 (cd a && find .) | sort >a.lst
67 'echo ignore me >a/ignored &&
68 echo ignored export-ignore >.git/info/attributes'
71 'add files to repository' \
72 'find a -type f | xargs git update-index --add &&
73 find a -type l | xargs git update-index --add &&
74 treeid=`git write-tree` &&
75 echo $treeid >treeid &&
76 git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
77 git commit-tree $treeid </dev/null)'
81 'git clone --bare . bare.git &&
82 cp .git/info/attributes bare.git/info/attributes'
85 'remove ignored file' \
89 'git archive --format=zip' \
90 'git archive --format=zip HEAD >d.zip'
95 'git archive --format=zip in a bare repo' \
96 '(cd bare.git && git archive --format=zip HEAD) >d1.zip'
99 'git archive --format=zip vs. the same in a bare repo' \
100 'test_cmp d.zip d1.zip'
102 test_expect_success
'git archive --format=zip with --output' \
103 'git archive --format=zip --output=d2.zip HEAD &&
104 test_cmp d.zip d2.zip'
106 test_expect_success
'git archive with --output, inferring format' '
107 git archive --output=d3.zip HEAD &&
108 test_cmp d.zip d3.zip
111 test_expect_success \
112 'git archive --format=zip with prefix' \
113 'git archive --format=zip --prefix=prefix/ HEAD >e.zip'
117 test_expect_success
'git archive -0 --format=zip on large files' '
118 test_config core.bigfilethreshold 1 &&
119 git archive -0 --format=zip HEAD >large.zip
124 test_expect_success
'git archive --format=zip on large files' '
125 test_config core.bigfilethreshold 1 &&
126 git archive --format=zip HEAD >large-compressed.zip
129 check_zip large-compressed