Skip to content

Commit

Permalink
t5000: tar portability fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 14, 2008
1 parent bbf0812 commit 30684df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions t/t5000-tar-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ test_expect_success \

test_expect_success \
'validate file modification time' \
'TZ=GMT $TAR tvf b.tar a/a |
awk \{print\ \$4,\ \(length\(\$5\)\<7\)\ ?\ \$5\":00\"\ :\ \$5\} \
>b.mtime &&
echo "2005-05-27 22:00:00" >expected.mtime &&
'mkdir extract &&
$TAR xf b.tar -C extract a/a &&
perl -e '\''print((stat("extract/a/a"))[9], "\n")'\'' >b.mtime &&
echo "1117231200" >expected.mtime &&
diff expected.mtime b.mtime'

test_expect_success \
Expand Down

0 comments on commit 30684df

Please sign in to comment.