Merge branch 'jc/ci-upload-artifact-and-linux32'
[git/gitster.git] / t / t9803-git-p4-shell-metachars.sh
blobab7fe16266872c83235e4cd083ea2e44b0083567
1 #!/bin/sh
3 test_description='git p4 transparency to shell metachars in filenames'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./lib-git-p4.sh
8 test_expect_success 'start p4d' '
9 start_p4d
12 test_expect_success 'init depot' '
14 cd "$cli" &&
15 echo file1 >file1 &&
16 p4 add file1 &&
17 p4 submit -d "file1"
21 test_expect_success 'shell metachars in filenames' '
22 git p4 clone --dest="$git" //depot &&
23 test_when_finished cleanup_git &&
25 cd "$git" &&
26 git config git-p4.skipSubmitEditCheck true &&
27 echo f1 >foo\$bar &&
28 git add foo\$bar &&
29 echo f2 >"file with spaces" &&
30 git add "file with spaces" &&
31 git commit -m "add files" &&
32 P4EDITOR="test-tool chmtime +5" git p4 submit
33 ) &&
35 cd "$cli" &&
36 p4 sync ... &&
37 test -e "file with spaces" &&
38 test -e "foo\$bar"
42 test_expect_success 'deleting with shell metachars' '
43 git p4 clone --dest="$git" //depot &&
44 test_when_finished cleanup_git &&
46 cd "$git" &&
47 git config git-p4.skipSubmitEditCheck true &&
48 git rm foo\$bar &&
49 git rm file\ with\ spaces &&
50 git commit -m "remove files" &&
51 P4EDITOR="test-tool chmtime +5" git p4 submit
52 ) &&
54 cd "$cli" &&
55 p4 sync ... &&
56 test ! -e "file with spaces" &&
57 test ! -e foo\$bar
61 # Create a branch with a shell metachar in its name
63 # 1. //depot/main
64 # 2. //depot/branch$3
66 test_expect_success 'branch with shell char' '
67 test_when_finished cleanup_git &&
68 test_create_repo "$git" &&
70 cd "$cli" &&
72 mkdir -p main &&
74 echo f1 >main/f1 &&
75 p4 add main/f1 &&
76 p4 submit -d "main/f1" &&
78 p4 integrate //depot/main/... //depot/branch\$3/... &&
79 p4 submit -d "integrate main to branch\$3" &&
81 echo f1 >branch\$3/shell_char_branch_file &&
82 p4 add branch\$3/shell_char_branch_file &&
83 p4 submit -d "branch\$3/shell_char_branch_file" &&
85 p4 branch -i <<-EOF &&
86 Branch: branch\$3
87 View: //depot/main/... //depot/branch\$3/...
88 EOF
90 p4 edit main/f1 &&
91 echo "a change" >> main/f1 &&
92 p4 submit -d "a change" main/f1 &&
94 p4 integrate -b branch\$3 &&
95 p4 resolve -am branch\$3/... &&
96 p4 submit -d "integrate main to branch\$3" &&
98 cd "$git" &&
100 git config git-p4.branchList main:branch\$3 &&
101 git p4 clone --dest=. --detect-branches //depot@all &&
102 git log --all --graph --decorate --stat &&
103 git reset --hard p4/depot/branch\$3 &&
104 test -f shell_char_branch_file &&
105 test -f f1
109 test_done