]>
Commit | Line | Data |
---|---|---|
d3d49c3d RS |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (C) 2005 Rene Scharfe | |
4 | # | |
5 | ||
925ceccf | 6 | test_description='git archive and git get-tar-commit-id test |
d3d49c3d | 7 | |
5b860406 RS |
8 | This test covers the topics of file contents, commit date handling and |
9 | commit id embedding: | |
d3d49c3d RS |
10 | |
11 | The contents of the repository is compared to the extracted tar | |
12 | archive. The repository contains simple text files, symlinks and a | |
3dff5379 | 13 | binary file (/bin/sh). Only paths shorter than 99 characters are |
5b860406 | 14 | used. |
d3d49c3d | 15 | |
925ceccf | 16 | git archive applies the commit date to every file in the archive it |
d3d49c3d RS |
17 | creates. The test sets the commit date to a specific value and checks |
18 | if the tar archive contains that value. | |
19 | ||
925ceccf | 20 | When giving git archive a commit id (in contrast to a tree id) it |
d3d49c3d | 21 | embeds this commit id into the tar archive as a comment. The test |
5be60078 | 22 | checks the ability of git get-tar-commit-id to figure it out from the |
d3d49c3d RS |
23 | tar file. |
24 | ||
25 | ' | |
26 | ||
8da0b02d | 27 | TEST_CREATE_REPO_NO_TEMPLATE=1 |
d3d49c3d RS |
28 | . ./test-lib.sh |
29 | ||
38c9c9b7 | 30 | SUBSTFORMAT=%H%n |
8460b2fc | 31 | |
9bf1ac41 RS |
32 | test_lazy_prereq TAR_NEEDS_PAX_FALLBACK ' |
33 | ( | |
34 | mkdir pax && | |
35 | cd pax && | |
36 | "$TAR" xf "$TEST_DIRECTORY"/t5000/pax.tar && | |
37 | test -f PaxHeaders.1791/file | |
38 | ) | |
39 | ' | |
40 | ||
96174145 JK |
41 | test_lazy_prereq GZIP 'gzip --version' |
42 | ||
9bf1ac41 RS |
43 | get_pax_header() { |
44 | file=$1 | |
45 | header=$2= | |
46 | ||
47 | while read len rest | |
48 | do | |
49 | if test "$len" = $(echo "$len $rest" | wc -c) | |
50 | then | |
51 | case "$rest" in | |
52 | $header*) | |
53 | echo "${rest#$header}" | |
54 | ;; | |
55 | esac | |
56 | fi | |
57 | done <"$file" | |
58 | } | |
59 | ||
deb9c8ed RS |
60 | check_tar() { |
61 | tarfile=$1.tar | |
62 | listfile=$1.lst | |
63 | dir=$1 | |
64 | dir_with_prefix=$dir/$2 | |
65 | ||
66 | test_expect_success ' extract tar archive' ' | |
67 | (mkdir $dir && cd $dir && "$TAR" xf -) <$tarfile | |
68 | ' | |
69 | ||
9bf1ac41 RS |
70 | test_expect_success TAR_NEEDS_PAX_FALLBACK ' interpret pax headers' ' |
71 | ( | |
72 | cd $dir && | |
73 | for header in *.paxheader | |
74 | do | |
75 | data=${header%.paxheader}.data && | |
d0b30a3d | 76 | if test -h $data || test -e $data |
9bf1ac41 RS |
77 | then |
78 | path=$(get_pax_header $header path) && | |
79 | if test -n "$path" | |
80 | then | |
d0fd9931 | 81 | mv "$data" "$path" || exit 1 |
9bf1ac41 RS |
82 | fi |
83 | fi | |
84 | done | |
85 | ) | |
86 | ' | |
87 | ||
deb9c8ed RS |
88 | test_expect_success ' validate filenames' ' |
89 | (cd ${dir_with_prefix}a && find .) | sort >$listfile && | |
90 | test_cmp a.lst $listfile | |
91 | ' | |
92 | ||
93 | test_expect_success ' validate file contents' ' | |
94 | diff -r a ${dir_with_prefix}a | |
95 | ' | |
96 | } | |
97 | ||
2947a793 RS |
98 | check_added() { |
99 | dir=$1 | |
100 | path_in_fs=$2 | |
101 | path_in_archive=$3 | |
102 | ||
103 | test_expect_success " validate extra file $path_in_archive" ' | |
104 | diff -r $path_in_fs $dir/$path_in_archive | |
105 | ' | |
106 | } | |
107 | ||
fd2da4b1 RS |
108 | check_mtime() { |
109 | dir=$1 | |
110 | path_in_archive=$2 | |
111 | mtime=$3 | |
112 | ||
113 | test_expect_success " validate mtime of $path_in_archive" ' | |
114 | test-tool chmtime --get $dir/$path_in_archive >actual.mtime && | |
115 | echo $mtime >expect.mtime && | |
116 | test_cmp expect.mtime actual.mtime | |
117 | ' | |
118 | } | |
119 | ||
0b78a1b2 | 120 | test_expect_success 'setup' ' |
121 | test_oid_cache <<-EOF | |
122 | obj sha1:19f9c8273ec45a8938e6999cb59b3ff66739902a | |
123 | obj sha256:3c666f798798601571f5cec0adb57ce4aba8546875e7693177e0535f34d2c49b | |
124 | EOF | |
125 | ' | |
126 | ||
d6b6cd13 JH |
127 | test_expect_success '--list notices extra parameters' ' |
128 | test_must_fail git archive --list blah && | |
129 | test_must_fail git archive --remote=. --list blah | |
130 | ' | |
131 | ||
132 | test_expect_success 'end-of-options is correctly eaten' ' | |
133 | git archive --list --end-of-options && | |
134 | git archive --remote=. --list --end-of-options | |
135 | ' | |
136 | ||
9c8e7e96 HWN |
137 | test_expect_success 'populate workdir' ' |
138 | mkdir a && | |
139 | echo simple textfile >a/a && | |
140 | ten=0123456789 && | |
141 | hundred="$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten" && | |
142 | echo long filename >"a/four$hundred" && | |
143 | mkdir a/bin && | |
144 | test-tool genrandom "frotz" 500000 >a/bin/sh && | |
145 | printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 && | |
146 | printf "A not substituted O" >a/substfile2 && | |
147 | if test_have_prereq SYMLINKS | |
148 | then | |
149 | ln -s a a/l1 | |
150 | else | |
151 | printf %s a >a/l1 | |
152 | fi && | |
153 | ( | |
154 | p=long_path_to_a_file && | |
155 | cd a && | |
156 | for depth in 1 2 3 4 5 | |
157 | do | |
158 | mkdir $p && | |
d0fd9931 | 159 | cd $p || exit 1 |
9c8e7e96 HWN |
160 | done && |
161 | echo text >file_with_long_path | |
162 | ) && | |
163 | (cd a && find .) | sort >a.lst | |
164 | ' | |
d3d49c3d | 165 | |
008d896d RS |
166 | test_expect_success \ |
167 | 'add ignored file' \ | |
168 | 'echo ignore me >a/ignored && | |
8da0b02d | 169 | mkdir .git/info && |
ad94657f | 170 | echo ignored export-ignore >.git/info/attributes' |
008d896d | 171 | |
21711ca4 RS |
172 | test_expect_success 'add files to repository' ' |
173 | git add a && | |
174 | GIT_COMMITTER_DATE="2005-05-27 22:00" git commit -m initial | |
175 | ' | |
d3d49c3d | 176 | |
c420df7b RS |
177 | test_expect_success 'setup export-subst' ' |
178 | echo "substfile?" export-subst >>.git/info/attributes && | |
179 | git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \ | |
180 | >a/substfile1 | |
181 | ' | |
182 | ||
9c8e7e96 | 183 | test_expect_success 'create bare clone' ' |
8da0b02d ÆAB |
184 | git clone --template= --bare . bare.git && |
185 | mkdir bare.git/info && | |
9c8e7e96 HWN |
186 | cp .git/info/attributes bare.git/info/attributes |
187 | ' | |
ddff8563 | 188 | |
9c8e7e96 HWN |
189 | test_expect_success 'remove ignored file' ' |
190 | rm a/ignored | |
191 | ' | |
008d896d | 192 | |
9c8e7e96 HWN |
193 | test_expect_success 'git archive' ' |
194 | git archive HEAD >b.tar | |
195 | ' | |
8ff21b1a | 196 | |
deb9c8ed | 197 | check_tar b |
1aaed69d | 198 | check_mtime b a/a 1117231200 |
deb9c8ed | 199 | |
fd2da4b1 RS |
200 | test_expect_success 'git archive --mtime' ' |
201 | git archive --mtime=2002-02-02T02:02:02-0200 HEAD >with_mtime.tar | |
202 | ' | |
203 | ||
204 | check_tar with_mtime | |
205 | check_mtime with_mtime a/a 1012622522 | |
206 | ||
03d9bc56 RS |
207 | test_expect_success 'git archive --prefix=prefix/' ' |
208 | git archive --prefix=prefix/ HEAD >with_prefix.tar | |
209 | ' | |
210 | ||
211 | check_tar with_prefix prefix/ | |
212 | ||
213 | test_expect_success 'git-archive --prefix=olde-' ' | |
214 | git archive --prefix=olde- HEAD >with_olde-prefix.tar | |
215 | ' | |
216 | ||
217 | check_tar with_olde-prefix olde- | |
218 | ||
2947a793 RS |
219 | test_expect_success 'git archive --add-file' ' |
220 | echo untracked >untracked && | |
221 | git archive --add-file=untracked HEAD >with_untracked.tar | |
222 | ' | |
223 | ||
224 | check_tar with_untracked | |
225 | check_added with_untracked untracked untracked | |
226 | ||
227 | test_expect_success 'git archive --add-file twice' ' | |
228 | echo untracked >untracked && | |
229 | git archive --prefix=one/ --add-file=untracked \ | |
230 | --prefix=two/ --add-file=untracked \ | |
231 | --prefix= HEAD >with_untracked2.tar | |
232 | ' | |
233 | ||
234 | check_tar with_untracked2 | |
235 | check_added with_untracked2 untracked one/untracked | |
236 | check_added with_untracked2 untracked two/untracked | |
237 | ||
5544049d | 238 | test_expect_success 'git archive on large files' ' |
9c8e7e96 HWN |
239 | test_config core.bigfilethreshold 1 && |
240 | git archive HEAD >b3.tar && | |
241 | test_cmp_bin b.tar b3.tar | |
5544049d NTND |
242 | ' |
243 | ||
9c8e7e96 HWN |
244 | test_expect_success 'git archive in a bare repo' ' |
245 | git --git-dir bare.git archive HEAD >b3.tar | |
246 | ' | |
ddff8563 | 247 | |
9c8e7e96 HWN |
248 | test_expect_success 'git archive vs. the same in a bare repo' ' |
249 | test_cmp_bin b.tar b3.tar | |
250 | ' | |
ddff8563 | 251 | |
9c8e7e96 HWN |
252 | test_expect_success 'git archive with --output' ' |
253 | git archive --output=b4.tar HEAD && | |
254 | test_cmp_bin b.tar b4.tar | |
255 | ' | |
aec0c1bb | 256 | |
9c8e7e96 HWN |
257 | test_expect_success 'git archive --remote' ' |
258 | git archive --remote=. HEAD >b5.tar && | |
259 | test_cmp_bin b.tar b5.tar | |
260 | ' | |
48139269 | 261 | |
eb0224c6 JH |
262 | test_expect_success 'git archive --remote with configured remote' ' |
263 | git config remote.foo.url . && | |
264 | ( | |
265 | cd a && | |
266 | git archive --remote=foo --output=../b5-nick.tar HEAD | |
267 | ) && | |
268 | test_cmp_bin b.tar b5-nick.tar | |
269 | ' | |
270 | ||
f1ed2247 HWN |
271 | test_expect_success 'git get-tar-commit-id' ' |
272 | git get-tar-commit-id <b.tar >actual && | |
273 | git rev-parse HEAD >expect && | |
274 | test_cmp expect actual | |
275 | ' | |
d3d49c3d | 276 | |
fe12d8e8 RS |
277 | test_expect_success 'git archive with --output, override inferred format' ' |
278 | git archive --format=tar --output=d4.zip HEAD && | |
b93e6e36 | 279 | test_cmp_bin b.tar d4.zip |
fe12d8e8 RS |
280 | ' |
281 | ||
00436bf1 JS |
282 | test_expect_success GZIP 'git archive with --output and --remote creates .tgz' ' |
283 | git archive --output=d5.tgz --remote=. HEAD && | |
284 | gzip -d -c <d5.tgz >d5.tar && | |
285 | test_cmp_bin b.tar d5.tar | |
286 | ' | |
287 | ||
eb0224c6 JH |
288 | test_expect_success 'git archive --list outside of a git repo' ' |
289 | nongit git archive --list | |
290 | ' | |
291 | ||
292 | test_expect_success 'git archive --remote outside of a git repo' ' | |
293 | git archive HEAD >expect.tar && | |
294 | nongit git archive --remote="$PWD" HEAD >actual.tar && | |
295 | test_cmp_bin expect.tar actual.tar | |
296 | ' | |
265d5280 | 297 | |
ee27ca4a JK |
298 | test_expect_success 'clients cannot access unreachable commits' ' |
299 | test_commit unreachable && | |
f5efd519 | 300 | sha1=$(git rev-parse HEAD) && |
ee27ca4a JK |
301 | git reset --hard HEAD^ && |
302 | git archive $sha1 >remote.tar && | |
303 | test_must_fail git archive --remote=. $sha1 >remote.tar | |
304 | ' | |
305 | ||
7671b632 SG |
306 | test_expect_success 'upload-archive can allow unreachable commits' ' |
307 | test_commit unreachable1 && | |
f5efd519 | 308 | sha1=$(git rev-parse HEAD) && |
7671b632 SG |
309 | git reset --hard HEAD^ && |
310 | git archive $sha1 >remote.tar && | |
311 | test_config uploadarchive.allowUnreachable true && | |
312 | git archive --remote=. $sha1 >remote.tar | |
313 | ' | |
314 | ||
767cf457 JK |
315 | test_expect_success 'setup tar filters' ' |
316 | git config tar.tar.foo.command "tr ab ba" && | |
7b97730b | 317 | git config tar.bar.command "tr ab ba" && |
785a0429 JK |
318 | git config tar.bar.remote true && |
319 | git config tar.invalid baz | |
767cf457 JK |
320 | ' |
321 | ||
322 | test_expect_success 'archive --list mentions user filter' ' | |
323 | git archive --list >output && | |
324 | grep "^tar\.foo\$" output && | |
325 | grep "^bar\$" output | |
326 | ' | |
327 | ||
1bc01efe | 328 | test_expect_success 'archive --list shows only enabled remote filters' ' |
767cf457 | 329 | git archive --list --remote=. >output && |
7b97730b | 330 | ! grep "^tar\.foo\$" output && |
767cf457 JK |
331 | grep "^bar\$" output |
332 | ' | |
333 | ||
334 | test_expect_success 'invoke tar filter by format' ' | |
335 | git archive --format=tar.foo HEAD >config.tar.foo && | |
336 | tr ab ba <config.tar.foo >config.tar && | |
b93e6e36 | 337 | test_cmp_bin b.tar config.tar && |
767cf457 JK |
338 | git archive --format=bar HEAD >config.bar && |
339 | tr ab ba <config.bar >config.tar && | |
b93e6e36 | 340 | test_cmp_bin b.tar config.tar |
767cf457 JK |
341 | ' |
342 | ||
343 | test_expect_success 'invoke tar filter by extension' ' | |
344 | git archive -o config-implicit.tar.foo HEAD && | |
b93e6e36 | 345 | test_cmp_bin config.tar.foo config-implicit.tar.foo && |
767cf457 | 346 | git archive -o config-implicit.bar HEAD && |
b93e6e36 | 347 | test_cmp_bin config.tar.foo config-implicit.bar |
767cf457 JK |
348 | ' |
349 | ||
350 | test_expect_success 'default output format remains tar' ' | |
351 | git archive -o config-implicit.baz HEAD && | |
b93e6e36 | 352 | test_cmp_bin b.tar config-implicit.baz |
767cf457 JK |
353 | ' |
354 | ||
355 | test_expect_success 'extension matching requires dot' ' | |
356 | git archive -o config-implicittar.foo HEAD && | |
b93e6e36 | 357 | test_cmp_bin b.tar config-implicittar.foo |
767cf457 JK |
358 | ' |
359 | ||
1bc01efe | 360 | test_expect_success 'only enabled filters are available remotely' ' |
7b97730b JK |
361 | test_must_fail git archive --remote=. --format=tar.foo HEAD \ |
362 | >remote.tar.foo && | |
363 | git archive --remote=. --format=bar >remote.bar HEAD && | |
b93e6e36 | 364 | test_cmp_bin remote.bar config.bar |
7b97730b JK |
365 | ' |
366 | ||
1e4ea950 RS |
367 | test_expect_success 'invalid filter is reported only once' ' |
368 | test_must_fail git -c tar.invalid.command= archive --format=invalid \ | |
369 | HEAD >out 2>err && | |
370 | test_must_be_empty out && | |
371 | test_line_count = 1 err | |
372 | ' | |
373 | ||
4f4be00d | 374 | test_expect_success 'git archive --format=tgz' ' |
0e804e09 JK |
375 | git archive --format=tgz HEAD >j.tgz |
376 | ' | |
377 | ||
4f4be00d | 378 | test_expect_success 'git archive --format=tar.gz' ' |
0e804e09 | 379 | git archive --format=tar.gz HEAD >j1.tar.gz && |
b93e6e36 | 380 | test_cmp_bin j.tgz j1.tar.gz |
0e804e09 JK |
381 | ' |
382 | ||
4f4be00d | 383 | test_expect_success 'infer tgz from .tgz filename' ' |
0e804e09 | 384 | git archive --output=j2.tgz HEAD && |
b93e6e36 | 385 | test_cmp_bin j.tgz j2.tgz |
0e804e09 JK |
386 | ' |
387 | ||
4f4be00d | 388 | test_expect_success 'infer tgz from .tar.gz filename' ' |
0e804e09 | 389 | git archive --output=j3.tar.gz HEAD && |
b93e6e36 | 390 | test_cmp_bin j.tgz j3.tar.gz |
0e804e09 JK |
391 | ' |
392 | ||
96174145 JK |
393 | test_expect_success GZIP 'extract tgz file' ' |
394 | gzip -d -c <j.tgz >j.tar && | |
b93e6e36 | 395 | test_cmp_bin b.tar j.tar |
0e804e09 JK |
396 | ' |
397 | ||
4f4be00d | 398 | test_expect_success 'remote tar.gz is allowed by default' ' |
7b97730b | 399 | git archive --remote=. --format=tar.gz HEAD >remote.tar.gz && |
b93e6e36 | 400 | test_cmp_bin j.tgz remote.tar.gz |
7b97730b JK |
401 | ' |
402 | ||
4f4be00d | 403 | test_expect_success 'remote tar.gz can be disabled' ' |
7b97730b JK |
404 | git config tar.tar.gz.remote false && |
405 | test_must_fail git archive --remote=. --format=tar.gz HEAD \ | |
406 | >remote.tar.gz | |
407 | ' | |
408 | ||
4f4be00d RS |
409 | test_expect_success GZIP 'git archive --format=tgz (external gzip)' ' |
410 | test_config tar.tgz.command "gzip -cn" && | |
411 | git archive --format=tgz HEAD >external_gzip.tgz | |
76d76026 RS |
412 | ' |
413 | ||
4f4be00d RS |
414 | test_expect_success GZIP 'git archive --format=tar.gz (external gzip)' ' |
415 | test_config tar.tar.gz.command "gzip -cn" && | |
416 | git archive --format=tar.gz HEAD >external_gzip.tar.gz && | |
417 | test_cmp_bin external_gzip.tgz external_gzip.tar.gz | |
76d76026 RS |
418 | ' |
419 | ||
4f4be00d RS |
420 | test_expect_success GZIP 'extract tgz file (external gzip)' ' |
421 | gzip -d -c <external_gzip.tgz >external_gzip.tar && | |
422 | test_cmp_bin b.tar external_gzip.tar | |
76d76026 RS |
423 | ' |
424 | ||
ed22b417 NTND |
425 | test_expect_success 'archive and :(glob)' ' |
426 | git archive -v HEAD -- ":(glob)**/sh" >/dev/null 2>actual && | |
d912a603 KF |
427 | cat >expect <<-\EOF && |
428 | a/ | |
429 | a/bin/ | |
430 | a/bin/sh | |
431 | EOF | |
ed22b417 NTND |
432 | test_cmp expect actual |
433 | ' | |
434 | ||
435 | test_expect_success 'catch non-matching pathspec' ' | |
436 | test_must_fail git archive -v HEAD -- "*.abc" >/dev/null | |
437 | ' | |
438 | ||
92b1dd1b RS |
439 | test_expect_success 'reject paths outside the current directory' ' |
440 | test_must_fail git -C a/bin archive HEAD .. >/dev/null 2>err && | |
441 | grep "outside the current directory" err | |
442 | ' | |
443 | ||
444 | test_expect_success 'allow pathspecs that resolve to the current directory' ' | |
445 | git -C a/bin archive -v HEAD ../bin >/dev/null 2>actual && | |
446 | cat >expect <<-\EOF && | |
447 | sh | |
448 | EOF | |
449 | test_cmp expect actual | |
450 | ' | |
451 | ||
e51217e1 JK |
452 | # Pull the size and date of each entry in a tarfile using the system tar. |
453 | # | |
454 | # We'll pull out only the year from the date; that avoids any question of | |
455 | # timezones impacting the result (as long as we keep our test times away from a | |
456 | # year boundary; our reference times are all in August). | |
457 | # | |
458 | # The output of tar_info is expected to be "<size> <year>", both in decimal. It | |
459 | # ignores the return value of tar. We have to do this, because some of our test | |
460 | # input is only partial (the real data is 64GB in some cases). | |
461 | tar_info () { | |
462 | "$TAR" tvf "$1" | | |
463 | awk '{ | |
464 | split($4, date, "-") | |
465 | print $3 " " date[1] | |
466 | }' | |
467 | } | |
468 | ||
469 | # See if our system tar can handle a tar file with huge sizes and dates far in | |
470 | # the future, and that we can actually parse its output. | |
471 | # | |
472 | # The reference file was generated by GNU tar, and the magic time and size are | |
473 | # both octal 01000000000001, which overflows normal ustar fields. | |
474 | test_lazy_prereq TAR_HUGE ' | |
475 | echo "68719476737 4147" >expect && | |
476 | tar_info "$TEST_DIRECTORY"/t5000/huge-and-future.tar >actual && | |
477 | test_cmp expect actual | |
478 | ' | |
479 | ||
29493589 | 480 | test_expect_success LONG_IS_64BIT 'set up repository with huge blob' ' |
0b78a1b2 | 481 | obj=$(test_oid obj) && |
482 | path=$(test_oid_to_path $obj) && | |
483 | mkdir -p .git/objects/$(dirname $path) && | |
484 | cp "$TEST_DIRECTORY"/t5000/huge-object .git/objects/$path && | |
e51217e1 JK |
485 | rm -f .git/index && |
486 | git update-index --add --cacheinfo 100644,$obj,huge && | |
487 | git commit -m huge | |
488 | ' | |
489 | ||
490 | # We expect git to die with SIGPIPE here (otherwise we | |
491 | # would generate the whole 64GB). | |
29493589 | 492 | test_expect_success LONG_IS_64BIT 'generate tar with huge size' ' |
e51217e1 JK |
493 | { |
494 | git archive HEAD | |
495 | echo $? >exit-code | |
496 | } | test_copy_bytes 4096 >huge.tar && | |
497 | echo 141 >expect && | |
498 | test_cmp expect exit-code | |
499 | ' | |
500 | ||
29493589 | 501 | test_expect_success TAR_HUGE,LONG_IS_64BIT 'system tar can read our huge size' ' |
e51217e1 JK |
502 | echo 68719476737 >expect && |
503 | tar_info huge.tar | cut -d" " -f1 >actual && | |
504 | test_cmp expect actual | |
505 | ' | |
506 | ||
f90fca63 AK |
507 | test_expect_success TIME_IS_64BIT 'set up repository with far-future (2^34 - 1) commit' ' |
508 | rm -f .git/index && | |
509 | echo foo >file && | |
510 | git add file && | |
511 | GIT_COMMITTER_DATE="@17179869183 +0000" \ | |
512 | git commit -m "tempori parendum" | |
513 | ' | |
514 | ||
515 | test_expect_success TIME_IS_64BIT 'generate tar with far-future mtime' ' | |
516 | git archive HEAD >future.tar | |
517 | ' | |
518 | ||
519 | test_expect_success TAR_HUGE,TIME_IS_64BIT,TIME_T_IS_64BIT 'system tar can read our future mtime' ' | |
520 | echo 2514 >expect && | |
521 | tar_info future.tar | cut -d" " -f2 >actual && | |
522 | test_cmp expect actual | |
523 | ' | |
524 | ||
525 | test_expect_success TIME_IS_64BIT 'set up repository with far-far-future (2^36 + 1) commit' ' | |
e51217e1 JK |
526 | rm -f .git/index && |
527 | echo content >file && | |
528 | git add file && | |
f90fca63 | 529 | GIT_TEST_COMMIT_GRAPH=0 GIT_COMMITTER_DATE="@68719476737 +0000" \ |
e51217e1 JK |
530 | git commit -m "tempori parendum" |
531 | ' | |
532 | ||
f90fca63 | 533 | test_expect_success TIME_IS_64BIT 'generate tar with far-far-future mtime' ' |
e51217e1 JK |
534 | git archive HEAD >future.tar |
535 | ' | |
536 | ||
efac8ac8 | 537 | test_expect_success TAR_HUGE,TIME_IS_64BIT,TIME_T_IS_64BIT 'system tar can read our future mtime' ' |
e51217e1 JK |
538 | echo 4147 >expect && |
539 | tar_info future.tar | cut -d" " -f2 >actual && | |
540 | test_cmp expect actual | |
541 | ' | |
542 | ||
d3d49c3d | 543 | test_done |