The seventh batch of topics graduated to 'master'
[git/gitweb.git] / t / t9807-git-p4-submit.sh
blob15417165e8900a87fbfbe54e757306e9070ea06f
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
34 # make two commits, but tell it to apply only from HEAD^
35 test_expect_success 'submit --origin' '
36 test_when_finished cleanup_git &&
37 git p4 clone --dest="$git" //depot &&
39 cd "$git" &&
40 test_commit "file3" &&
41 test_commit "file4" &&
42 git config git-p4.skipSubmitEdit true &&
43 git p4 submit --origin=HEAD^
44 ) &&
46 cd "$cli" &&
47 p4 sync &&
48 test_path_is_missing "file3.t" &&
49 test_path_is_file "file4.t"
53 test_expect_success 'submit with allowSubmit' '
54 test_when_finished cleanup_git &&
55 git p4 clone --dest="$git" //depot &&
57 cd "$git" &&
58 test_commit "file5" &&
59 git config git-p4.skipSubmitEdit true &&
60 git config git-p4.allowSubmit "nobranch" &&
61 test_must_fail git p4 submit &&
62 git config git-p4.allowSubmit "nobranch,master" &&
63 git p4 submit
67 test_expect_success 'submit with master branch name from argv' '
68 test_when_finished cleanup_git &&
69 git p4 clone --dest="$git" //depot &&
71 cd "$git" &&
72 test_commit "file6" &&
73 git config git-p4.skipSubmitEdit true &&
74 test_must_fail git p4 submit nobranch &&
75 git branch otherbranch &&
76 git reset --hard HEAD^ &&
77 test_commit "file7" &&
78 git p4 submit otherbranch
79 ) &&
81 cd "$cli" &&
82 p4 sync &&
83 test_path_is_file "file6.t" &&
84 test_path_is_missing "file7.t"
88 test_expect_success 'kill p4d' '
89 kill_p4d
92 test_done