@matheusbsbs / matheus-bagliano / commits / 30684dfaf8
Fork 0

t5000: tar portability fix

The output of 'tar tv' varies from system to system. In particular, the t5000 was expecting to parse the date from something like: -rw-rw-r-- root/root 0 2008-05-13 04:27 file but FreeBSD's tar produces this: -rw-rw-r-- 0 root root 0 May 13 04:27 file Instead of relying on tar's output, let's just extract the file using tar and stat the result using perl. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 13, 2008 at 04:45 UTC 30684dfaf8cf96e5afc01668acc01acc0ade59db
1 file changed +4 -4
t/t5000-tar-tree.sh
+4 -4
@@ -67,10 +67,10 @@ test_expect_success \
67
68 test_expect_success \
69 'validate file modification time' \
70 - 'TZ=GMT $TAR tvf b.tar a/a |
71 - awk \{print\ \$4,\ \(length\(\$5\)\<7\)\ ?\ \$5\":00\"\ :\ \$5\} \
72 - >b.mtime &&
73 - echo "2005-05-27 22:00:00" >expected.mtime &&
70 + 'mkdir extract &&
71 + $TAR xf b.tar -C extract a/a &&
72 + perl -e '\''print((stat("extract/a/a"))[9], "\n")'\'' >b.mtime &&
73 + echo "1117231200" >expected.mtime &&
74 diff expected.mtime b.mtime'
75
76 test_expect_success \