Sync with 'master'
[alt-git.git] / t / t9822-git-p4-path-encoding.sh
blobe62ed49f51e02263c4a1c5615f6fe825939f8a6c
1 #!/bin/sh
3 test_description='Clone repositories with non ASCII paths'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./lib-git-p4.sh
8 UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
9 ISO8859_ESCAPED="a-\344_o-\366_u-\374.txt"
11 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
12 echo content123 >"$ISO8859" &&
13 rm "$ISO8859" || {
14 skip_all="fs does not accept ISO-8859-1 filenames"
15 test_done
18 test_expect_success 'start p4d' '
19 start_p4d
22 test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
24 cd "$cli" &&
25 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
26 echo content123 >"$ISO8859" &&
27 p4 add "$ISO8859" &&
28 p4 submit -d "test commit"
32 test_expect_failure 'Clone auto-detects depot with iso8859-1 paths' '
33 git p4 clone --destination="$git" //depot &&
34 test_when_finished cleanup_git &&
36 cd "$git" &&
37 UTF8="$(printf "$UTF8_ESCAPED")" &&
38 echo "$UTF8" >expect &&
39 git -c core.quotepath=false ls-files >actual &&
40 test_cmp expect actual
44 test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' '
45 test_when_finished cleanup_git &&
47 cd "$git" &&
48 git init . &&
49 git config git-p4.pathEncoding iso8859-1 &&
50 git p4 clone --use-client-spec --destination="$git" //depot &&
51 UTF8="$(printf "$UTF8_ESCAPED")" &&
52 echo "$UTF8" >expect &&
53 git -c core.quotepath=false ls-files >actual &&
54 test_cmp expect actual &&
56 echo content123 >expect &&
57 cat "$UTF8" >actual &&
58 test_cmp expect actual
62 test_expect_success 'Delete iso8859-1 encoded paths and clone' '
64 cd "$cli" &&
65 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
66 p4 delete "$ISO8859" &&
67 p4 submit -d "remove file"
68 ) &&
69 git p4 clone --destination="$git" //depot@all &&
70 test_when_finished cleanup_git &&
72 cd "$git" &&
73 git -c core.quotepath=false ls-files >actual &&
74 test_must_be_empty actual
78 test_done