| 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_lazy_prereq FS_ACCEPTS_ISO_8859_1 ' |
| 11 | ISO8859="$(printf "$ISO8859_ESCAPED")" && |
| 12 | echo content123 >"$ISO8859" && |
| 13 | rm "$ISO8859" |
| 14 | ' |
| 15 | |
| 16 | if ! test_have_prereq FS_ACCEPTS_ISO_8859_1 |
| 17 | then |
| 18 | skip_all="fs does not accept ISO-8859-1 filenames" |
| 19 | test_done |
| 20 | fi |
| 21 | |
| 22 | test_expect_success 'start p4d' ' |
| 23 | start_p4d |
| 24 | ' |
| 25 | |
| 26 | test_expect_success 'Create a repo containing iso8859-1 encoded paths' ' |
| 27 | ( |
| 28 | cd "$cli" && |
| 29 | ISO8859="$(printf "$ISO8859_ESCAPED")" && |
| 30 | echo content123 >"$ISO8859" && |
| 31 | p4 add "$ISO8859" && |
| 32 | p4 submit -d "test commit" |
| 33 | ) |
| 34 | ' |
| 35 | |
| 36 | test_expect_failure 'Clone auto-detects depot with iso8859-1 paths' ' |
| 37 | git p4 clone --destination="$git" //depot && |
| 38 | test_when_finished cleanup_git && |
| 39 | ( |
| 40 | cd "$git" && |
| 41 | UTF8="$(printf "$UTF8_ESCAPED")" && |
| 42 | echo "$UTF8" >expect && |
| 43 | git -c core.quotepath=false ls-files >actual && |
| 44 | test_cmp expect actual |
| 45 | ) |
| 46 | ' |
| 47 | |
| 48 | test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' ' |
| 49 | test_when_finished cleanup_git && |
| 50 | ( |
| 51 | cd "$git" && |
| 52 | git init . && |
| 53 | git config git-p4.pathEncoding iso8859-1 && |
| 54 | git p4 clone --use-client-spec --destination="$git" //depot && |
| 55 | UTF8="$(printf "$UTF8_ESCAPED")" && |
| 56 | echo "$UTF8" >expect && |
| 57 | git -c core.quotepath=false ls-files >actual && |
| 58 | test_cmp expect actual && |
| 59 | |
| 60 | echo content123 >expect && |
| 61 | cat "$UTF8" >actual && |
| 62 | test_cmp expect actual |
| 63 | ) |
| 64 | ' |
| 65 | |
| 66 | test_expect_success 'Delete iso8859-1 encoded paths and clone' ' |
| 67 | ( |
| 68 | cd "$cli" && |
| 69 | ISO8859="$(printf "$ISO8859_ESCAPED")" && |
| 70 | p4 delete "$ISO8859" && |
| 71 | p4 submit -d "remove file" |
| 72 | ) && |
| 73 | git p4 clone --destination="$git" //depot@all && |
| 74 | test_when_finished cleanup_git && |
| 75 | ( |
| 76 | cd "$git" && |
| 77 | git -c core.quotepath=false ls-files >actual && |
| 78 | test_must_be_empty actual |
| 79 | ) |
| 80 | ' |
| 81 | |
| 82 | test_done |