Revert "fmt-merge-msg: stop treating `master` specially"
[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 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
15 }
16
17 test_expect_success 'start p4d' '
18         start_p4d
19 '
20
21 test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
22         (
23                 cd "$cli" &&
24                 ISO8859="$(printf "$ISO8859_ESCAPED")" &&
25                 echo content123 >"$ISO8859" &&
26                 p4 add "$ISO8859" &&
27                 p4 submit -d "test commit"
28         )
29 '
30
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 &&
34         (
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
40         )
41 '
42
43 test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' '
44         test_when_finished cleanup_git &&
45         (
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 &&
54
55                 echo content123 >expect &&
56                 cat "$UTF8" >actual &&
57                 test_cmp expect actual
58         )
59 '
60
61 test_expect_success 'Delete iso8859-1 encoded paths and clone' '
62         (
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 &&
70         (
71                 cd "$git" &&
72                 git -c core.quotepath=false ls-files >actual &&
73                 test_must_be_empty actual
74         )
75 '
76
77 test_done