doc: A few minor copy edits.
[git.git] / t / t9807-git-p4-submit.sh
blobf23b4c3620592704cac35839a010ce55de139da7
1 #!/bin/sh
3 test_description='git p4 submit'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8 start_p4d
11 test_expect_success 'init depot' '
13 cd "$cli" &&
14 echo file1 >file1 &&
15 p4 add file1 &&
16 p4 submit -d "change 1"
20 test_expect_success 'submit with no client dir' '
21 test_when_finished cleanup_git &&
22 git p4 clone --dest="$git" //depot &&
24 cd "$git" &&
25 echo file2 >file2 &&
26 git add file2 &&
27 git commit -m "git commit 2" &&
28 rm -rf "$cli" &&
29 git config git-p4.skipSubmitEdit true &&
30 git p4 submit
31 ) &&
33 cd "$cli" &&
34 test_path_is_file file1 &&
35 test_path_is_file file2
39 # make two commits, but tell it to apply only from HEAD^
40 test_expect_success 'submit --origin' '
41 test_when_finished cleanup_git &&
42 git p4 clone --dest="$git" //depot &&
44 cd "$git" &&
45 test_commit "file3" &&
46 test_commit "file4" &&
47 git config git-p4.skipSubmitEdit true &&
48 git p4 submit --origin=HEAD^
49 ) &&
51 cd "$cli" &&
52 test_path_is_missing "file3.t" &&
53 test_path_is_file "file4.t"
57 test_expect_success 'submit with allowSubmit' '
58 test_when_finished cleanup_git &&
59 git p4 clone --dest="$git" //depot &&
61 cd "$git" &&
62 test_commit "file5" &&
63 git config git-p4.skipSubmitEdit true &&
64 git config git-p4.allowSubmit "nobranch" &&
65 test_must_fail git p4 submit &&
66 git config git-p4.allowSubmit "nobranch,master" &&
67 git p4 submit
71 test_expect_success 'submit with master branch name from argv' '
72 test_when_finished cleanup_git &&
73 git p4 clone --dest="$git" //depot &&
75 cd "$git" &&
76 test_commit "file6" &&
77 git config git-p4.skipSubmitEdit true &&
78 test_must_fail git p4 submit nobranch &&
79 git branch otherbranch &&
80 git reset --hard HEAD^ &&
81 test_commit "file7" &&
82 git p4 submit otherbranch
83 ) &&
85 cd "$cli" &&
86 test_path_is_file "file6.t" &&
87 test_path_is_missing "file7.t"
92 # Basic submit tests, the five handled cases
95 test_expect_success 'submit modify' '
96 test_when_finished cleanup_git &&
97 git p4 clone --dest="$git" //depot &&
99 cd "$git" &&
100 git config git-p4.skipSubmitEdit true &&
101 echo line >>file1 &&
102 git add file1 &&
103 git commit -m file1 &&
104 git p4 submit
105 ) &&
107 cd "$cli" &&
108 test_path_is_file file1 &&
109 test_line_count = 2 file1
113 test_expect_success 'submit add' '
114 test_when_finished cleanup_git &&
115 git p4 clone --dest="$git" //depot &&
117 cd "$git" &&
118 git config git-p4.skipSubmitEdit true &&
119 echo file13 >file13 &&
120 git add file13 &&
121 git commit -m file13 &&
122 git p4 submit
123 ) &&
125 cd "$cli" &&
126 test_path_is_file file13
130 test_expect_success 'submit delete' '
131 test_when_finished cleanup_git &&
132 git p4 clone --dest="$git" //depot &&
134 cd "$git" &&
135 git config git-p4.skipSubmitEdit true &&
136 git rm file4.t &&
137 git commit -m "delete file4.t" &&
138 git p4 submit
139 ) &&
141 cd "$cli" &&
142 test_path_is_missing file4.t
146 test_expect_success 'submit copy' '
147 test_when_finished cleanup_git &&
148 git p4 clone --dest="$git" //depot &&
150 cd "$git" &&
151 git config git-p4.skipSubmitEdit true &&
152 git config git-p4.detectCopies true &&
153 git config git-p4.detectCopiesHarder true &&
154 cp file5.t file5.ta &&
155 git add file5.ta &&
156 git commit -m "copy to file5.ta" &&
157 git p4 submit
158 ) &&
160 cd "$cli" &&
161 test_path_is_file file5.ta &&
162 test ! -w file5.ta
166 test_expect_success 'submit rename' '
167 test_when_finished cleanup_git &&
168 git p4 clone --dest="$git" //depot &&
170 cd "$git" &&
171 git config git-p4.skipSubmitEdit true &&
172 git config git-p4.detectRenames true &&
173 git mv file6.t file6.ta &&
174 git commit -m "rename file6.t to file6.ta" &&
175 git p4 submit
176 ) &&
178 cd "$cli" &&
179 test_path_is_missing file6.t &&
180 test_path_is_file file6.ta &&
181 test ! -w file6.ta
185 test_expect_success 'kill p4d' '
186 kill_p4d
189 test_done