aboutsummaryrefslogtreecommitdiff
path: root/t/t9812-git-p4-wildcards.sh
blob: 67633257f3fccb2408d678759bce87f7a58acd0a (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
#!/bin/sh

test_description='git p4 wildcards'

. ./lib-git-p4.sh

test_expect_success 'start p4d' '
	start_p4d
'

test_expect_success 'add p4 files with wildcards in the names' '
	(
		cd "$cli" &&
		printf "file2\nhas\nsome\nrandom\ntext\n" >file2 &&
		p4 add file2 &&
		echo file-wild-hash >file-wild#hash &&
		if test_have_prereq NOT_MINGW NOT_CYGWIN
		then
			echo file-wild-star >file-wild\*star
		fi &&
		echo file-wild-at >file-wild@at &&
		echo file-wild-percent >file-wild%percent &&
		p4 add -f file-wild* &&
		p4 submit -d "file wildcards"
	)
'

test_expect_success 'wildcard files git p4 clone' '
	git p4 clone --dest="$git" //depot &&
	test_when_finished cleanup_git &&
	(
		cd "$git" &&
		test -f file-wild#hash &&
		if test_have_prereq NOT_MINGW NOT_CYGWIN
		then
			test -f file-wild\*star
		fi &&
		test -f file-wild@at &&
		test -f file-wild%percent
	)
'

test_expect_success 'wildcard files submit back to p4, add' '
	test_when_finished cleanup_git &&
	git p4 clone --dest="$git" //depot &&
	(
		cd "$git" &&
		echo git-wild-hash >git-wild#hash &&
		if test_have_prereq NOT_MINGW NOT_CYGWIN
		then
			echo git-wild-star >git-wild\*star
		fi &&
		echo git-wild-at >git-wild@at &&
		echo git-wild-percent >git-wild%percent &&
		git add git-wild* &&
		git commit -m "add some wildcard filenames" &&
		git config git-p4.skipSubmitEdit true &&
		git p4 submit
	) &&
	(
		cd "$cli" &&
		test_path_is_file git-wild#hash &&
		if test_have_prereq NOT_MINGW NOT_CYGWIN
		then
			test_path_is_file git-wild\*star
		fi &&
		test_path_is_file git-wild@at &&
		test_path_is_file git-wild%percent
	)
'

test_expect_success 'wildcard files submit back to p4, modify' '
	test_when_finished cleanup_git &&
	git p4 clone --dest="$git" //depot &&
	(
		cd "$git" &&
		echo new-line >>git-wild#hash &&
		if test_have_prereq NOT_MINGW NOT_CYGWIN
		then
			echo new-line >>git-wild\*star
		fi &&
		echo new-line >>git-wild@at &&
		echo new-line >>git-wild%percent &&
		git add git-wild* &&
		git commit -m "modify the wildcard files" &&
		git config git-p4.skipSubmitEdit true &&
		git p4 submit
	) &&
	(
		cd "$cli" &&
		test_line_count = 2 git-wild#hash &&
		if test_have_prereq NOT_MINGW NOT_CYGWIN
		then
			test_line_count = 2 git-wild\*star
		fi &&
		test_line_count = 2 git-wild@at &&
		test_line_count = 2 git-wild%percent
	)
'

test_expect_success 'wildcard files submit back to p4, copy' '
	test_when_finished cleanup_git &&
	git p4 clone --dest="$git" //depot &&
	(
		cd "$git" &&
		cp file2 git-wild-cp#hash &&
		git add git-wild-cp#hash &&
		cp git-wild#hash file-wild-3 &&
		git add file-wild-3 &&
		git commit -m "wildcard copies" &&
		git config git-p4.detectCopies true &&
		git config git-p4.detectCopiesHarder true &&
		git config git-p4.skipSubmitEdit true &&
		git p4 submit
	) &&
	(
		cd "$cli" &&
		test_path_is_file git-wild-cp#hash &&
		test_path_is_file file-wild-3
	)
'

test_expect_success 'wildcard files submit back to p4, rename' '
	test_when_finished cleanup_git &&
	git p4 clone --dest="$git" //depot &&
	(
		cd "$git" &&
		git mv git-wild@at file-wild-4 &&
		git mv file-wild-3 git-wild-cp%percent &&
		git commit -m "wildcard renames" &&
		git config git-p4.detectRenames true &&
		git config git-p4.skipSubmitEdit true &&
		git p4 submit
	) &&
	(
		cd "$cli" &&
		test_path_is_missing git-wild@at &&
		test_path_is_file git-wild-cp%percent
	)
'

test_expect_success 'wildcard files submit back to p4, delete' '
	test_when_finished cleanup_git &&
	git p4 clone --dest="$git" //depot &&
	(
		cd "$git" &&
		git rm git-wild* &&
		git commit -m "delete the wildcard files" &&
		git config git-p4.skipSubmitEdit true &&
		git p4 submit
	) &&
	(
		cd "$cli" &&
		test_path_is_missing git-wild#hash &&
		if test_have_prereq NOT_MINGW NOT_CYGWIN
		then
			test_path_is_missing git-wild\*star
		fi &&
		test_path_is_missing git-wild@at &&
		test_path_is_missing git-wild%percent
	)
'

test_expect_success 'kill p4d' '
	kill_p4d
'

test_done