Merge branch 'rs/apply-validate-input' into maint
[git/raj.git] / t / t9822-git-p4-path-encoding.sh
blobc78477c19b4330f990c0cdd7d96997b8ed2ed02c
1 #!/bin/sh
3 test_description='Clone repositories with non ASCII paths'
5 . ./lib-git-p4.sh
7 UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
8 ISO8859_ESCAPED="a-\344_o-\366_u-\374.txt"
10 test_expect_success 'start p4d' '
11 start_p4d
14 test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
16 cd "$cli" &&
17 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
18 echo content123 >"$ISO8859" &&
19 p4 add "$ISO8859" &&
20 p4 submit -d "test commit"
24 test_expect_failure 'Clone auto-detects depot with iso8859-1 paths' '
25 git p4 clone --destination="$git" //depot &&
26 test_when_finished cleanup_git &&
28 cd "$git" &&
29 UTF8="$(printf "$UTF8_ESCAPED")" &&
30 echo "$UTF8" >expect &&
31 git -c core.quotepath=false ls-files >actual &&
32 test_cmp expect actual
36 test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' '
37 test_when_finished cleanup_git &&
39 cd "$git" &&
40 git init . &&
41 git config git-p4.pathEncoding iso8859-1 &&
42 git p4 clone --use-client-spec --destination="$git" //depot &&
43 UTF8="$(printf "$UTF8_ESCAPED")" &&
44 echo "$UTF8" >expect &&
45 git -c core.quotepath=false ls-files >actual &&
46 test_cmp expect actual &&
48 echo content123 >expect &&
49 cat "$UTF8" >actual &&
50 test_cmp expect actual
54 test_expect_success 'Delete iso8859-1 encoded paths and clone' '
56 cd "$cli" &&
57 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
58 p4 delete "$ISO8859" &&
59 p4 submit -d "remove file"
60 ) &&
61 git p4 clone --destination="$git" //depot@all &&
62 test_when_finished cleanup_git &&
64 cd "$git" &&
65 git -c core.quotepath=false ls-files >actual &&
66 test_must_be_empty actual
70 test_expect_success 'kill p4d' '
71 kill_p4d
74 test_done