git-p4: only a single ... wildcard is supported
Catch the case where a ... exists at the end, and also elsehwere. Reported-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pete Wyckoff committed
Jan 11, 2012 at 18:31 UTC
43b82bd9c3a5ad597bbfc0c12a519d4053df01b8
2 files changed
+9
-3
contrib/fast-import/git-p4
+2
-2
@@ -1207,8 +1207,8 @@ class View(object):
1207
die("Can't handle * wildcards in view: %s" % self.path)
1208
triple_dot_index = self.path.find("...")
1209
if triple_dot_index >= 0:
1210
- if not self.path.endswith("..."):
1211
- die("Can handle ... wildcard only at end of path: %s" %
1210
+ if triple_dot_index != len(self.path) - 3:
1211
+ die("Can handle only single ... wildcard, at end: %s" %
1212
self.path)
1213
self.ends_triple_dot = True
1214
t/t9809-git-p4-client-view.sh
+7
-1
@@ -101,12 +101,18 @@ test_expect_success 'unsupported view wildcard *' '
101
test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
102
'
103
104
-test_expect_success 'wildcard ... only supported at end of spec' '
104
+test_expect_success 'wildcard ... only supported at end of spec 1' '
105
client_view "//depot/.../file11 //client/.../file11" &&
106
test_when_finished cleanup_git &&
107
test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
108
'
109
110
+test_expect_success 'wildcard ... only supported at end of spec 2' '
111
+ client_view "//depot/.../a/... //client/.../a/..." &&
112
+ test_when_finished cleanup_git &&
113
+ test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
114
+'
115
+
116
test_expect_success 'basic map' '
117
client_view "//depot/dir1/... //client/cli1/..." &&
118
files="cli1/file11 cli1/file12" &&