t / t0025-crlf-renormalize.shon commit t/helper: merge test-chmtime into test-tool (0e49649)
   1#!/bin/sh
   2
   3test_description='CRLF renormalization'
   4
   5. ./test-lib.sh
   6
   7test_expect_success setup '
   8        git config core.autocrlf false &&
   9        printf "LINEONE\nLINETWO\nLINETHREE\n" >LF.txt &&
  10        printf "LINEONE\r\nLINETWO\r\nLINETHREE\r\n" >CRLF.txt &&
  11        printf "LINEONE\r\nLINETWO\nLINETHREE\n" >CRLF_mix_LF.txt &&
  12        git add . &&
  13        git commit -m initial
  14'
  15
  16test_expect_success 'renormalize CRLF in repo' '
  17        echo "*.txt text=auto" >.gitattributes &&
  18        git add --renormalize "*.txt" &&
  19        cat >expect <<-\EOF &&
  20        i/lf w/crlf attr/text=auto CRLF.txt
  21        i/lf w/lf attr/text=auto LF.txt
  22        i/lf w/mixed attr/text=auto CRLF_mix_LF.txt
  23        EOF
  24        git ls-files --eol |
  25        sed -e "s/      / /g" -e "s/  */ /g" |
  26        sort >actual &&
  27        test_cmp expect actual
  28'
  29
  30test_done