git p4: generate better error message for bad depot path
authorPete Wyckoff <pw@padd.com>
Sun, 27 Jan 2013 03:11:06 +0000 (22:11 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sun, 27 Jan 2013 06:00:38 +0000 (22:00 -0800)
Depot paths must start with //. Exit with a better explanation
when a bad depot path is supplied.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py
t/t9800-git-p4-basic.sh
index 47d092d2e56033919a8a19a15f0912256e23ac69..cbf8525594b44db18bb4d53f392291415583e13d 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -3163,6 +3163,7 @@ def run(self, args):
         self.cloneExclude = ["/"+p for p in self.cloneExclude]
         for p in depotPaths:
             if not p.startswith("//"):
+                sys.stderr.write('Depot paths must start with "//": %s\n' % p)
                 return False
 
         if not self.cloneDestination:
index 166e75209fb561f975a4c01f800f845e15ababae..665607c9cbe5a07f83d4ae4c769060108bddbd9c 100755 (executable)
@@ -30,6 +30,11 @@ test_expect_success 'basic git p4 clone' '
        )
 '
 
+test_expect_success 'depot typo error' '
+       test_must_fail git p4 clone --dest="$git" /depot 2>errs &&
+       grep "Depot paths must start with" errs
+'
+
 test_expect_success 'git p4 clone @all' '
        git p4 clone --dest="$git" //depot@all &&
        test_when_finished cleanup_git &&