t / t0024-crlf-archive.shon commit Merge branch 'ap/log-mailmap' (577f63e)
   1#!/bin/sh
   2
   3test_description='respect crlf in git archive'
   4
   5. ./test-lib.sh
   6GIT_UNZIP=${GIT_UNZIP:-unzip}
   7
   8test_lazy_prereq UNZIP '
   9        "$GIT_UNZIP" -v
  10        test $? -ne 127
  11'
  12
  13test_expect_success setup '
  14
  15        git config core.autocrlf true &&
  16
  17        printf "CRLF line ending\r\nAnd another\r\n" > sample &&
  18        git add sample &&
  19
  20        test_tick &&
  21        git commit -m Initial
  22
  23'
  24
  25test_expect_success 'tar archive' '
  26
  27        git archive --format=tar HEAD |
  28        ( mkdir untarred && cd untarred && "$TAR" -xf - ) &&
  29
  30        test_cmp sample untarred/sample
  31
  32'
  33
  34test_expect_success UNZIP 'zip archive' '
  35
  36        git archive --format=zip HEAD >test.zip &&
  37
  38        ( mkdir unzipped && cd unzipped && "$GIT_UNZIP" ../test.zip ) &&
  39
  40        test_cmp sample unzipped/sample
  41
  42'
  43
  44test_done