Merge branch 'fc/git-complete-helper' into fc/git-prompt-script
[gitweb.git] / t / t9807-git-p4-submit.sh
index 15417165e8900a87fbfbe54e757306e9070ea06f..f23b4c3620592704cac35839a010ce55de139da7 100755 (executable)
@@ -28,6 +28,11 @@ test_expect_success 'submit with no client dir' '
                rm -rf "$cli" &&
                git config git-p4.skipSubmitEdit true &&
                git p4 submit
+       ) &&
+       (
+               cd "$cli" &&
+               test_path_is_file file1 &&
+               test_path_is_file file2
        )
 '
 
@@ -44,7 +49,6 @@ test_expect_success 'submit --origin' '
        ) &&
        (
                cd "$cli" &&
-               p4 sync &&
                test_path_is_missing "file3.t" &&
                test_path_is_file "file4.t"
        )
@@ -79,12 +83,105 @@ test_expect_success 'submit with master branch name from argv' '
        ) &&
        (
                cd "$cli" &&
-               p4 sync &&
                test_path_is_file "file6.t" &&
                test_path_is_missing "file7.t"
        )
 '
 
+#
+# Basic submit tests, the five handled cases
+#
+
+test_expect_success 'submit modify' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$git" &&
+               git config git-p4.skipSubmitEdit true &&
+               echo line >>file1 &&
+               git add file1 &&
+               git commit -m file1 &&
+               git p4 submit
+       ) &&
+       (
+               cd "$cli" &&
+               test_path_is_file file1 &&
+               test_line_count = 2 file1
+       )
+'
+
+test_expect_success 'submit add' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$git" &&
+               git config git-p4.skipSubmitEdit true &&
+               echo file13 >file13 &&
+               git add file13 &&
+               git commit -m file13 &&
+               git p4 submit
+       ) &&
+       (
+               cd "$cli" &&
+               test_path_is_file file13
+       )
+'
+
+test_expect_success 'submit delete' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$git" &&
+               git config git-p4.skipSubmitEdit true &&
+               git rm file4.t &&
+               git commit -m "delete file4.t" &&
+               git p4 submit
+       ) &&
+       (
+               cd "$cli" &&
+               test_path_is_missing file4.t
+       )
+'
+
+test_expect_success 'submit copy' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$git" &&
+               git config git-p4.skipSubmitEdit true &&
+               git config git-p4.detectCopies true &&
+               git config git-p4.detectCopiesHarder true &&
+               cp file5.t file5.ta &&
+               git add file5.ta &&
+               git commit -m "copy to file5.ta" &&
+               git p4 submit
+       ) &&
+       (
+               cd "$cli" &&
+               test_path_is_file file5.ta &&
+               test ! -w file5.ta
+       )
+'
+
+test_expect_success 'submit rename' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$git" &&
+               git config git-p4.skipSubmitEdit true &&
+               git config git-p4.detectRenames true &&
+               git mv file6.t file6.ta &&
+               git commit -m "rename file6.t to file6.ta" &&
+               git p4 submit
+       ) &&
+       (
+               cd "$cli" &&
+               test_path_is_missing file6.t &&
+               test_path_is_file file6.ta &&
+               test ! -w file6.ta
+       )
+'
+
 test_expect_success 'kill p4d' '
        kill_p4d
 '