git-p4: only a single ... wildcard is supported
authorPete Wyckoff <pw@padd.com>
Wed, 11 Jan 2012 23:31:06 +0000 (18:31 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Jan 2012 00:35:37 +0000 (16:35 -0800)
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>
contrib/fast-import/git-p4
t/t9809-git-p4-client-view.sh

index 3e1aa276cff93172cb476c54369c35fd255647b8..20208bfbc0c38e10f3265cbd80592628a76f3ff1 100755 (executable)
@@ -1207,8 +1207,8 @@ class View(object):
                 die("Can't handle * wildcards in view: %s" % self.path)
             triple_dot_index = self.path.find("...")
             if triple_dot_index >= 0:
-                if not self.path.endswith("..."):
-                    die("Can handle ... wildcard only at end of path: %s" %
+                if triple_dot_index != len(self.path) - 3:
+                    die("Can handle only single ... wildcard, at end: %s" %
                         self.path)
                 self.ends_triple_dot = True
 
index c9471d562ddf8e793453f0404db8553f0ec24754..54204af8fb810e0b845ea520a8779d3cde6334da 100755 (executable)
@@ -101,12 +101,18 @@ test_expect_success 'unsupported view wildcard *' '
        test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
 '
 
-test_expect_success 'wildcard ... only supported at end of spec' '
+test_expect_success 'wildcard ... only supported at end of spec 1' '
        client_view "//depot/.../file11 //client/.../file11" &&
        test_when_finished cleanup_git &&
        test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
 '
 
+test_expect_success 'wildcard ... only supported at end of spec 2' '
+       client_view "//depot/.../a/... //client/.../a/..." &&
+       test_when_finished cleanup_git &&
+       test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
+'
+
 test_expect_success 'basic map' '
        client_view "//depot/dir1/... //client/cli1/..." &&
        files="cli1/file11 cli1/file12" &&