git p4: generate better error message for bad depot path
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>
Pete Wyckoff committed
Jan 26, 2013 at 22:11 UTC
0f487d308d819cf6c64b866cb2f5c366a13b1639
2 files changed
+6
git-p4.py
+1
@@ -3163,6 +3163,7 @@ class P4Clone(P4Sync):
3163
self.cloneExclude = ["/"+p for p in self.cloneExclude]
3164
for p in depotPaths:
3165
if not p.startswith("//"):
3166
+ sys.stderr.write('Depot paths must start with "//": %s\n' % p)
3167
return False
3168
3169
if not self.cloneDestination:
t/t9800-git-p4-basic.sh
+5
@@ -30,6 +30,11 @@ test_expect_success 'basic git p4 clone' '
30
)
31
'
32
33
+test_expect_success 'depot typo error' '
34
+ test_must_fail git p4 clone --dest="$git" /depot 2>errs &&
35
+ grep "Depot paths must start with" errs
36
+'
37
+
38
test_expect_success 'git p4 clone @all' '
39
git p4 clone --dest="$git" //depot@all &&
40
test_when_finished cleanup_git &&