Fourth batch
[git/raj.git] / t / t9822-git-p4-path-encoding.sh
blob572d395498e30a3743b77c577d7c4b91d714b392
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 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
11 echo content123 >"$ISO8859" &&
12 rm "$ISO8859" || {
13 skip_all="fs does not accept ISO-8859-1 filenames"
14 test_done
17 test_expect_success 'start p4d' '
18 start_p4d
21 test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
23 cd "$cli" &&
24 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
25 echo content123 >"$ISO8859" &&
26 p4 add "$ISO8859" &&
27 p4 submit -d "test commit"
31 test_expect_failure 'Clone auto-detects depot with iso8859-1 paths' '
32 git p4 clone --destination="$git" //depot &&
33 test_when_finished cleanup_git &&
35 cd "$git" &&
36 UTF8="$(printf "$UTF8_ESCAPED")" &&
37 echo "$UTF8" >expect &&
38 git -c core.quotepath=false ls-files >actual &&
39 test_cmp expect actual
43 test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' '
44 test_when_finished cleanup_git &&
46 cd "$git" &&
47 git init . &&
48 git config git-p4.pathEncoding iso8859-1 &&
49 git p4 clone --use-client-spec --destination="$git" //depot &&
50 UTF8="$(printf "$UTF8_ESCAPED")" &&
51 echo "$UTF8" >expect &&
52 git -c core.quotepath=false ls-files >actual &&
53 test_cmp expect actual &&
55 echo content123 >expect &&
56 cat "$UTF8" >actual &&
57 test_cmp expect actual
61 test_expect_success 'Delete iso8859-1 encoded paths and clone' '
63 cd "$cli" &&
64 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
65 p4 delete "$ISO8859" &&
66 p4 submit -d "remove file"
67 ) &&
68 git p4 clone --destination="$git" //depot@all &&
69 test_when_finished cleanup_git &&
71 cd "$git" &&
72 git -c core.quotepath=false ls-files >actual &&
73 test_must_be_empty actual
77 test_done