Code

Update draft release notes to 1.7.10
[git.git] / t / t9807-git-p4-submit.sh
1 #!/bin/sh
3 test_description='git-p4 submit'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8         start_p4d
9 '
11 test_expect_success 'init depot' '
12         (
13                 cd "$cli" &&
14                 echo file1 >file1 &&
15                 p4 add file1 &&
16                 p4 submit -d "change 1"
17         )
18 '
20 test_expect_success 'submit with no client dir' '
21         test_when_finished cleanup_git &&
22         "$GITP4" clone --dest="$git" //depot &&
23         (
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                 "$GITP4" submit
31         )
32 '
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         "$GITP4" clone --dest="$git" //depot &&
38         (
39                 cd "$git" &&
40                 test_commit "file3" &&
41                 test_commit "file4" &&
42                 git config git-p4.skipSubmitEdit true &&
43                 "$GITP4" submit --origin=HEAD^
44         ) &&
45         (
46                 cd "$cli" &&
47                 p4 sync &&
48                 test_path_is_missing "file3.t" &&
49                 test_path_is_file "file4.t"
50         )
51 '
53 test_expect_success 'submit with allowSubmit' '
54         test_when_finished cleanup_git &&
55         "$GITP4" clone --dest="$git" //depot &&
56         (
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 "$GITP4" submit &&
62                 git config git-p4.allowSubmit "nobranch,master" &&
63                 "$GITP4" submit
64         )
65 '
67 test_expect_success 'submit with master branch name from argv' '
68         test_when_finished cleanup_git &&
69         "$GITP4" clone --dest="$git" //depot &&
70         (
71                 cd "$git" &&
72                 test_commit "file6" &&
73                 git config git-p4.skipSubmitEdit true &&
74                 test_must_fail "$GITP4" submit nobranch &&
75                 git branch otherbranch &&
76                 git reset --hard HEAD^ &&
77                 test_commit "file7" &&
78                 "$GITP4" submit otherbranch
79         ) &&
80         (
81                 cd "$cli" &&
82                 p4 sync &&
83                 test_path_is_file "file6.t" &&
84                 test_path_is_missing "file7.t"
85         )
86 '
88 test_expect_success 'kill p4d' '
89         kill_p4d
90 '
92 test_done