1#!/bin/sh
   2test_description='respect crlf in git archive'
   4. ./test-lib.sh
   6UNZIP=${UNZIP:-unzip}
   7test_expect_success setup '
   9        git config core.autocrlf true
  11        printf "CRLF line ending\r\nAnd another\r\n" > sample &&
  13        git add sample &&
  14        test_tick &&
  16        git commit -m Initial
  17'
  19test_expect_success 'tar archive' '
  21        git archive --format=tar HEAD |
  23        ( mkdir untarred && cd untarred && "$TAR" -xf - )
  24        test_cmp sample untarred/sample
  26'
  28"$UNZIP" -v >/dev/null 2>&1
  30if [ $? -eq 127 ]; then
  31        say "Skipping ZIP test, because unzip was not found"
  32else
  33        test_set_prereq UNZIP
  34fi
  35test_expect_success UNZIP 'zip archive' '
  37        git archive --format=zip HEAD >test.zip &&
  39        ( mkdir unzipped && cd unzipped && unzip ../test.zip ) &&
  41        test_cmp sample unzipped/sample
  43'
  45test_done