#!/bin/sh global test_description := ''interaction with P4 case-folding'' source ./lib-git-p4.sh if test_have_prereq CASE_INSENSITIVE_FS { global skip_all := ''skipping P4 case-folding tests; case insensitive file system detected'' test_done } test_expect_success 'start p4d with case folding enabled' ' start_p4d -C1 ' test_expect_success 'Create a repo, name is lowercase' ' ( client_view "//depot/... //client/..." && cd "$cli" && mkdir -p lc UC && >lc/file.txt && >UC/file.txt && p4 add lc/file.txt UC/file.txt && p4 submit -d "Add initial lc and UC repos" ) ' test_expect_success 'Check p4 is in case-folding mode' ' ( cd "$cli" && >lc/FILE.TXT && p4 add lc/FILE.TXT && test_must_fail p4 submit -d "Cannot add file differing only in case" lc/FILE.TXT ) ' # Check we created the repo properly test_expect_success 'Clone lc repo using lc name' ' git p4 clone //depot/lc/... && test_path_is_file lc/file.txt && git p4 clone //depot/UC/... && test_path_is_file UC/file.txt ' # The clone should fail, since there is no repo called LC, but because # we have case-insensitive p4d enabled, it appears to go ahead and work, # but leaves an empty git repo in place. test_expect_failure 'Clone lc repo using uc name' ' test_must_fail git p4 clone //depot/LC/... ' test_expect_failure 'Clone UC repo with lc name' ' test_must_fail git p4 clone //depot/uc/... ' 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 <"interaction with P4 case-folding">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./lib-git-p4.sh)}) (If arms: [ (if_arm cond: [(C {(test_have_prereq)} {(CASE_INSENSITIVE_FS)})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(SQ <"skipping P4 case-folding tests; case insensitive file system detected">)} spids: [24] ) ] spids: [24] ) (C {(test_done)}) ] spids: [-1 21] ) ] spids: [-1 32] ) (C {(test_expect_success)} {(SQ <"start p4d with case folding enabled">)} {(SQ <"\n"> <"\tstart_p4d -C1\n">)} ) (C {(test_expect_success)} {(SQ <"Create a repo, name is lowercase">)} { (SQ <"\n"> <"\t(\n"> <"\t\tclient_view \"//depot/... //client/...\" &&\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\tmkdir -p lc UC &&\n"> <"\t\t>lc/file.txt && >UC/file.txt &&\n"> <"\t\tp4 add lc/file.txt UC/file.txt &&\n"> <"\t\tp4 submit -d \"Add initial lc and UC repos\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"Check p4 is in case-folding mode">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\t>lc/FILE.TXT &&\n"> <"\t\tp4 add lc/FILE.TXT &&\n"> <"\t\ttest_must_fail p4 submit -d \"Cannot add file differing only in case\" lc/FILE.TXT\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"Clone lc repo using lc name">)} { (SQ <"\n"> <"\tgit p4 clone //depot/lc/... &&\n"> <"\ttest_path_is_file lc/file.txt &&\n"> <"\tgit p4 clone //depot/UC/... &&\n"> <"\ttest_path_is_file UC/file.txt\n"> ) } ) (C {(test_expect_failure)} {(SQ <"Clone lc repo using uc name">)} {(SQ <"\n"> <"\ttest_must_fail git p4 clone //depot/LC/...\n">)} ) (C {(test_expect_failure)} {(SQ <"Clone UC repo with lc name">)} {(SQ <"\n"> <"\ttest_must_fail git p4 clone //depot/uc/...\n">)} ) (C {(test_expect_success)} {(SQ <"kill p4d">)} {(SQ <"\n"> <"\tkill_p4d\n">)}) (C {(test_done)}) ] )