#!/bin/sh global test_description := ''Clone repositories with non ASCII paths'' source ./lib-git-p4.sh global UTF8_ESCAPED := '"a-\303\244_o-\303\266_u-\303\274.txt'" global ISO8859_ESCAPED := '"a-\344_o-\366_u-\374.txt'" test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'Create a repo containing iso8859-1 encoded paths' ' ( cd "$cli" && ISO8859="$(printf "$ISO8859_ESCAPED")" && echo content123 >"$ISO8859" && p4 add "$ISO8859" && p4 submit -d "test commit" ) ' test_expect_failure 'Clone auto-detects depot with iso8859-1 paths' ' git p4 clone --destination="$git" //depot && test_when_finished cleanup_git && ( cd "$git" && UTF8="$(printf "$UTF8_ESCAPED")" && echo "$UTF8" >expect && git -c core.quotepath=false ls-files >actual && test_cmp expect actual ) ' test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' ' test_when_finished cleanup_git && ( cd "$git" && git init . && git config git-p4.pathEncoding iso8859-1 && git p4 clone --use-client-spec --destination="$git" //depot && UTF8="$(printf "$UTF8_ESCAPED")" && echo "$UTF8" >expect && git -c core.quotepath=false ls-files >actual && test_cmp expect actual && echo content123 >expect && cat "$UTF8" >actual && test_cmp expect actual ) ' test_expect_success 'kill p4d' ' kill_p4d ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Clone repositories with non ASCII paths">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./lib-git-p4.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:UTF8_ESCAPED) op: Equal rhs: { (DQ (a-) (EscapedLiteralPart token:) (03) (EscapedLiteralPart token:) (44_o-) (EscapedLiteralPart token:) (03) (EscapedLiteralPart token:) (66_u-) (EscapedLiteralPart token:) (03) (EscapedLiteralPart token:) (74.txt) ) } spids: [15] ) ] spids: [15] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ISO8859_ESCAPED) op: Equal rhs: { (DQ (a-) (EscapedLiteralPart token:) (44_o-) (EscapedLiteralPart token:) (66_u-) (EscapedLiteralPart token:) (74.txt) ) } spids: [32] ) ] spids: [32] ) (C {(test_expect_success)} {(SQ <"start p4d">)} {(SQ <"\n"> <"\tstart_p4d\n">)}) (C {(test_expect_success)} {(SQ <"Create a repo containing iso8859-1 encoded paths">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\tISO8859=\"$(printf \"$ISO8859_ESCAPED\")\" &&\n"> <"\t\techo content123 >\"$ISO8859\" &&\n"> <"\t\tp4 add \"$ISO8859\" &&\n"> <"\t\tp4 submit -d \"test commit\"\n"> <"\t)\n"> ) } ) (C {(test_expect_failure)} {(SQ <"Clone auto-detects depot with iso8859-1 paths">)} { (SQ <"\n"> <"\tgit p4 clone --destination=\"$git\" //depot &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tUTF8=\"$(printf \"$UTF8_ESCAPED\")\" &&\n"> <"\t\techo \"$UTF8\" >expect &&\n"> <"\t\tgit -c core.quotepath=false ls-files >actual &&\n"> <"\t\ttest_cmp expect actual\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit init . &&\n"> <"\t\tgit config git-p4.pathEncoding iso8859-1 &&\n"> <"\t\tgit p4 clone --use-client-spec --destination=\"$git\" //depot &&\n"> <"\t\tUTF8=\"$(printf \"$UTF8_ESCAPED\")\" &&\n"> <"\t\techo \"$UTF8\" >expect &&\n"> <"\t\tgit -c core.quotepath=false ls-files >actual &&\n"> <"\t\ttest_cmp expect actual &&\n"> <"\n"> <"\t\techo content123 >expect &&\n"> <"\t\tcat \"$UTF8\" >actual &&\n"> <"\t\ttest_cmp expect actual\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"kill p4d">)} {(SQ <"\n"> <"\tkill_p4d\n">)}) (C {(test_done)}) ] )