Merge branch 'jh/json-writer'
[git] / t / t9831-git-p4-triggers.sh
1 #!/bin/sh
2
3 test_description='git p4 with server triggers'
4
5 . ./lib-git-p4.sh
6
7 test_expect_success 'start p4d' '
8         start_p4d
9 '
10
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                 echo file2 >file2 &&
18                 p4 add file2 &&
19                 p4 submit -d "change 2"
20         )
21 '
22
23 test_expect_success 'clone with extra info lines from verbose p4 trigger' '
24         test_when_finished cleanup_git &&
25         (
26                 p4 triggers -i <<-EOF
27                 Triggers: p4triggertest-command command pre-user-change "echo verbose trigger"
28                 EOF
29         ) &&
30         (
31                 p4 change -o |  grep -s "verbose trigger"
32         ) &&
33         git p4 clone --dest="$git" //depot/@all &&
34         (
35                 p4 triggers -i <<-EOF
36                 Triggers:
37                 EOF
38         )
39 '
40
41 test_expect_success 'import with extra info lines from verbose p4 trigger' '
42         test_when_finished cleanup_git &&
43         (
44                 cd "$cli" &&
45                 echo file3 >file3 &&
46                 p4 add file3 &&
47                 p4 submit -d "change 3"
48         ) &&
49         (
50                 p4 triggers -i <<-EOF
51                 Triggers: p4triggertest-command command pre-user-describe "echo verbose trigger"
52                 EOF
53         ) &&
54         (
55                 p4 describe 1 |  grep -s "verbose trigger"
56         ) &&
57         git p4 clone --dest="$git" //depot/@all &&
58         (
59                 cd "$git" &&
60                 git p4 sync
61         )&&
62         (
63                 p4 triggers -i <<-EOF
64                 Triggers:
65                 EOF
66         )
67 '
68
69 test_expect_success 'submit description with extra info lines from verbose p4 change trigger' '
70         test_when_finished cleanup_git &&
71         (
72                 p4 triggers -i <<-EOF
73                 Triggers: p4triggertest-command command pre-user-change "echo verbose trigger"
74                 EOF
75         ) &&
76         (
77                 p4 change -o |  grep -s "verbose trigger"
78         ) &&
79         git p4 clone --dest="$git" //depot &&
80         (
81                 cd "$git" &&
82                 git config git-p4.skipSubmitEdit true &&
83                 echo file4 >file4 &&
84                 git add file4 &&
85                 git commit -m file4 &&
86                 git p4 submit
87         ) &&
88         (
89                 p4 triggers -i <<-EOF
90                 Triggers:
91                 EOF
92         ) &&
93         (
94                 cd "$cli" &&
95                 test_path_is_file file4
96         )
97 '
98
99 test_expect_success 'kill p4d' '
100         kill_p4d
101 '
102
103 test_done