connect.c: handle errors from split_cmdline
[gitweb.git] / t / t9807-git-p4-submit.sh
index 1f74a88385e827f7162256fafc22db5de3d41bf8..e37239e657964e948e51e5ac186f5fdf4fab6003 100755 (executable)
@@ -389,7 +389,7 @@ test_expect_success 'description with Jobs section and bogus following text' '
        (
                cd "$cli" &&
                p4 revert desc6 &&
-               rm desc6
+               rm -f desc6
        )
 '
 
@@ -413,6 +413,75 @@ test_expect_success 'submit --prepare-p4-only' '
        )
 '
 
+test_expect_success 'submit --shelve' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$cli" &&
+               p4 revert ... &&
+               cd "$git" &&
+               git config git-p4.skipSubmitEdit true &&
+               test_commit "shelveme1" &&
+               git p4 submit --origin=HEAD^ &&
+
+               echo 654321 >shelveme2.t &&
+               echo 123456 >>shelveme1.t &&
+               git add shelveme* &&
+               git commit -m"shelvetest" &&
+               git p4 submit --shelve --origin=HEAD^ &&
+
+               test_path_is_file shelveme1.t &&
+               test_path_is_file shelveme2.t
+       ) &&
+       (
+               cd "$cli" &&
+               change=$(p4 -G changes -s shelved -m 1 //depot/... | \
+                        marshal_dump change) &&
+               p4 describe -S $change | grep shelveme2 &&
+               p4 describe -S $change | grep 123456 &&
+               test_path_is_file shelveme1.t &&
+               test_path_is_missing shelveme2.t
+       )
+'
+
+# Update an existing shelved changelist
+
+test_expect_success 'submit --update-shelve' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$cli" &&
+               p4 revert ... &&
+               cd "$git" &&
+               git config git-p4.skipSubmitEdit true &&
+               test_commit "test-update-shelved-change" &&
+               git p4 submit --origin=HEAD^ --shelve &&
+
+               shelf_cl=$(p4 -G changes -s shelved -m 1 |\
+                       marshal_dump change) &&
+               test -n $shelf_cl &&
+               echo "updating shelved change list $shelf_cl" &&
+
+               echo "updated-line" >>shelf.t &&
+               echo added-file.t >added-file.t &&
+               git add shelf.t added-file.t &&
+               git rm -f test-update-shelved-change.t &&
+               git commit --amend -C HEAD &&
+               git show --stat HEAD &&
+               git p4 submit -v --origin HEAD^ --update-shelve $shelf_cl &&
+               echo "done git p4 submit"
+       ) &&
+       (
+               cd "$cli" &&
+               change=$(p4 -G changes -s shelved -m 1 //depot/... | \
+                        marshal_dump change) &&
+               p4 unshelve -c $change -s $change &&
+               grep -q updated-line shelf.t &&
+               p4 describe -S $change | grep added-file.t &&
+               test_path_is_missing test-update-shelved-change.t
+       )
+'
+
 test_expect_success 'kill p4d' '
        kill_p4d
 '