git p4: test submit

Try each of the five diff patterns that might happen during submit. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pete Wyckoff committed Apr 29, 2012 at 20:57 UTC 0f224e5b73a73f37887eb7cb3e51073f889a3f9c
1 file changed +92
t/t9807-git-p4-submit.sh
+92
@@ -88,6 +88,98 @@ test_expect_success 'submit with master branch name from argv' '
88 )
89 '
90
91 +#
92 +# Basic submit tests, the five handled cases
93 +#
94 +
95 +test_expect_success 'submit modify' '
96 + test_when_finished cleanup_git &&
97 + git p4 clone --dest="$git" //depot &&
98 + (
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 + ) &&
106 + (
107 + cd "$cli" &&
108 + test_path_is_file file1 &&
109 + test_line_count = 2 file1
110 + )
111 +'
112 +
113 +test_expect_success 'submit add' '
114 + test_when_finished cleanup_git &&
115 + git p4 clone --dest="$git" //depot &&
116 + (
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 + ) &&
124 + (
125 + cd "$cli" &&
126 + test_path_is_file file13
127 + )
128 +'
129 +
130 +test_expect_success 'submit delete' '
131 + test_when_finished cleanup_git &&
132 + git p4 clone --dest="$git" //depot &&
133 + (
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 + ) &&
140 + (
141 + cd "$cli" &&
142 + test_path_is_missing file4.t
143 + )
144 +'
145 +
146 +test_expect_success 'submit copy' '
147 + test_when_finished cleanup_git &&
148 + git p4 clone --dest="$git" //depot &&
149 + (
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 + ) &&
159 + (
160 + cd "$cli" &&
161 + test_path_is_file file5.ta
162 + )
163 +'
164 +
165 +test_expect_success 'submit rename' '
166 + test_when_finished cleanup_git &&
167 + git p4 clone --dest="$git" //depot &&
168 + (
169 + cd "$git" &&
170 + git config git-p4.skipSubmitEdit true &&
171 + git config git-p4.detectRenames true &&
172 + git mv file6.t file6.ta &&
173 + git commit -m "rename file6.t to file6.ta" &&
174 + git p4 submit
175 + ) &&
176 + (
177 + cd "$cli" &&
178 + test_path_is_missing file6.t &&
179 + test_path_is_file file6.ta
180 + )
181 +'
182 +
183 test_expect_success 'kill p4d' '
184 kill_p4d
185 '