fetch: make the --prune-tags work with <url>
[gitweb.git] / t / t9807-git-p4-submit.sh
index e37239e657964e948e51e5ac186f5fdf4fab6003..71cae2874d935e16b951160c9a3fa0014fe2db27 100755 (executable)
@@ -139,6 +139,22 @@ test_expect_success 'submit with master branch name from argv' '
        )
 '
 
+test_expect_success 'allow submit from branch with same revision but different name' '
+       test_when_finished cleanup_git &&
+       git p4 clone --dest="$git" //depot &&
+       (
+               cd "$git" &&
+               test_commit "file8" &&
+               git checkout -b branch1 &&
+               git checkout -b branch2 &&
+               git config git-p4.skipSubmitEdit true &&
+               git config git-p4.allowSubmit "branch1" &&
+               test_must_fail git p4 submit &&
+               git checkout branch1 &&
+               git p4 submit
+       )
+'
+
 #
 # Basic submit tests, the five handled cases
 #
@@ -444,7 +460,13 @@ test_expect_success 'submit --shelve' '
        )
 '
 
-# Update an existing shelved changelist
+make_shelved_cl() {
+       test_commit "$1" >/dev/null &&
+       git p4 submit --origin HEAD^ --shelve >/dev/null &&
+       p4 -G changes -s shelved -m 1 | marshal_dump change
+}
+
+# Update existing shelved changelists
 
 test_expect_success 'submit --update-shelve' '
        test_when_finished cleanup_git &&
@@ -454,21 +476,19 @@ test_expect_success 'submit --update-shelve' '
                p4 revert ... &&
                cd "$git" &&
                git config git-p4.skipSubmitEdit true &&
-               test_commit "test-update-shelved-change" &&
-               git p4 submit --origin=HEAD^ --shelve &&
+               shelved_cl0=$(make_shelved_cl "shelved-change-0") &&
+               echo shelved_cl0=$shelved_cl0 &&
+               shelved_cl1=$(make_shelved_cl "shelved-change-1") &&
 
-               shelf_cl=$(p4 -G changes -s shelved -m 1 |\
-                       marshal_dump change) &&
-               test -n $shelf_cl &&
-               echo "updating shelved change list $shelf_cl" &&
+               echo "updating shelved change lists $shelved_cl0 and $shelved_cl1" &&
 
                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 rm -f shelved-change-1.t &&
                git commit --amend -C HEAD &&
                git show --stat HEAD &&
-               git p4 submit -v --origin HEAD^ --update-shelve $shelf_cl &&
+               git p4 submit -v --origin HEAD~2 --update-shelve $shelved_cl0 --update-shelve $shelved_cl1 &&
                echo "done git p4 submit"
        ) &&
        (
@@ -478,7 +498,7 @@ test_expect_success 'submit --update-shelve' '
                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_path_is_missing shelved-change-1.t
        )
 '