blob: 397b3e857da1798b4ea32520d55e1d65aa0b5bb2 (
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
|
#!/bin/sh
test_description='git p4 submit failure handling'
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
start_p4d
'
test_expect_success 'init depot' '
(
cd "$cli" &&
p4 client -o | sed "/LineEnd/s/:.*/:unix/" | p4 client -i &&
echo line1 >file1 &&
p4 add file1 &&
p4 submit -d "line1 in file1"
)
'
test_expect_success 'conflict on one commit' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$cli" &&
p4 open file1 &&
echo line2 >>file1 &&
p4 submit -d "line2 in file1"
) &&
(
# now this commit should cause a conflict
cd "$git" &&
git config git-p4.skipSubmitEdit true &&
echo line3 >>file1 &&
git add file1 &&
git commit -m "line3 in file1 will conflict" &&
test_expect_code 1 git p4 submit >out &&
test_i18ngrep "No commits applied" out
)
'
test_expect_success 'conflict on second of two commits' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$cli" &&
p4 open file1 &&
echo line3 >>file1 &&
p4 submit -d "line3 in file1"
) &&
(
cd "$git" &&
git config git-p4.skipSubmitEdit true &&
# this commit is okay
test_commit "first_commit_okay" &&
# now this submit should cause a conflict
echo line4 >>file1 &&
git add file1 &&
git commit -m "line4 in file1 will conflict" &&
test_expect_code 1 git p4 submit >out &&
test_i18ngrep "Applied only the commits" out
)
'
test_expect_success 'conflict on first of two commits, skip' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$cli" &&
p4 open file1 &&
echo line4 >>file1 &&
p4 submit -d "line4 in file1"
) &&
(
cd "$git" &&
git config git-p4.skipSubmitEdit true &&
# this submit should cause a conflict
echo line5 >>file1 &&
git add file1 &&
git commit -m "line5 in file1 will conflict" &&
# but this commit is okay
test_commit "okay_commit_after_skip" &&
echo s | test_expect_code 1 git p4 submit >out &&
test_i18ngrep "Applied only the commits" out
)
'
test_expect_success 'conflict on first of two commits, quit' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$cli" &&
p4 open file1 &&
echo line7 >>file1 &&
p4 submit -d "line7 in file1"
) &&
(
cd "$git" &&
git config git-p4.skipSubmitEdit true &&
# this submit should cause a conflict
echo line8 >>file1 &&
git add file1 &&
git commit -m "line8 in file1 will conflict" &&
# but this commit is okay
test_commit "okay_commit_after_quit" &&
echo q | test_expect_code 1 git p4 submit >out &&
test_i18ngrep "No commits applied" out
)
'
test_expect_success 'kill p4d' '
kill_p4d
'
test_done
|