Merge branch 'ls/p4-retry-thrice'
[git] / t / t9822-git-p4-path-encoding.sh
1 #!/bin/sh
2
3 test_description='Clone repositories with non ASCII paths'
4
5 . ./lib-git-p4.sh
6
7 UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
8 ISO8859_ESCAPED="a-\344_o-\366_u-\374.txt"
9
10 test_expect_success 'start p4d' '
11         start_p4d
12 '
13
14 test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
15         (
16                 cd "$cli" &&
17                 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
18                 echo content123 >"$ISO8859" &&
19                 p4 add "$ISO8859" &&
20                 p4 submit -d "test commit"
21         )
22 '
23
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 &&
27         (
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
33         )
34 '
35
36 test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' '
37         test_when_finished cleanup_git &&
38         (
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 &&
47
48                 echo content123 >expect &&
49                 cat "$UTF8" >actual &&
50                 test_cmp expect actual
51         )
52 '
53
54 test_expect_success 'kill p4d' '
55         kill_p4d
56 '
57
58 test_done