builtin/update-index: convert to using the_hash_algo
[git.git] / t / t9825-git-p4-handle-utf16-without-bom.sh
blob1551845dc178e3cc57d31ac3e66f60db921be874
1 #!/bin/sh
3 test_description='git p4 handling of UTF-16 files without BOM'
5 . ./lib-git-p4.sh
7 UTF16="\227\000\227\000"
9 test_expect_success 'start p4d' '
10 start_p4d
13 test_expect_success 'init depot with UTF-16 encoded file and artificially remove BOM' '
15 cd "$cli" &&
16 printf "$UTF16" >file1 &&
17 p4 add -t utf16 file1 &&
18 p4 submit -d "file1"
19 ) &&
22 cd db &&
23 p4d -jc &&
24 # P4D automatically adds a BOM. Remove it here to make the file invalid.
25 sed -e "\$d" depot/file1,v >depot/file1,v.new &&
26 mv depot/file1,v.new depot/file1,v &&
27 printf "@$UTF16@" >>depot/file1,v &&
28 p4d -jrF checkpoint.1
32 test_expect_success 'clone depot with invalid UTF-16 file in verbose mode' '
33 git p4 clone --dest="$git" --verbose //depot &&
34 test_when_finished cleanup_git &&
36 cd "$git" &&
37 printf "$UTF16" >expect &&
38 test_cmp_bin expect file1
42 test_expect_failure 'clone depot with invalid UTF-16 file in non-verbose mode' '
43 git p4 clone --dest="$git" //depot
46 test_expect_success 'kill p4d' '
47 kill_p4d
50 test_done