blob: f23b4c3620592704cac35839a010ce55de139da7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
#!/bin/sh
test_description='git p4 submit'
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
start_p4d
'
test_expect_success 'init depot' '
(
cd "$cli" &&
echo file1 >file1 &&
p4 add file1 &&
p4 submit -d "change 1"
)
'
test_expect_success 'submit with no client dir' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
echo file2 >file2 &&
git add file2 &&
git commit -m "git commit 2" &&
rm -rf "$cli" &&
git config git-p4.skipSubmitEdit true &&
git p4 submit
) &&
(
cd "$cli" &&
test_path_is_file file1 &&
test_path_is_file file2
)
'
# make two commits, but tell it to apply only from HEAD^
test_expect_success 'submit --origin' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file3" &&
test_commit "file4" &&
git config git-p4.skipSubmitEdit true &&
git p4 submit --origin=HEAD^
) &&
(
cd "$cli" &&
test_path_is_missing "file3.t" &&
test_path_is_file "file4.t"
)
'
test_expect_success 'submit with allowSubmit' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file5" &&
git config git-p4.skipSubmitEdit true &&
git config git-p4.allowSubmit "nobranch" &&
test_must_fail git p4 submit &&
git config git-p4.allowSubmit "nobranch,master" &&
git p4 submit
)
'
test_expect_success 'submit with master branch name from argv' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file6" &&
git config git-p4.skipSubmitEdit true &&
test_must_fail git p4 submit nobranch &&
git branch otherbranch &&
git reset --hard HEAD^ &&
test_commit "file7" &&
git p4 submit otherbranch
) &&
(
cd "$cli" &&
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
'
test_done
|