From 057a64d54acd14dfe07d8eb7725985df110237e2 Mon Sep 17 00:00:00 2001 From: Bernard Ogden Date: Mon, 20 Apr 2015 12:50:40 +0100 Subject: Change error message to contemplate possible non-identifier inputs Change-Id: Ice655f950130b3c4314e04e407512df3e041a4af --- lib/checkout.sh | 2 +- testsuite/test.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/checkout.sh b/lib/checkout.sh index 091264b0..83fbb957 100644 --- a/lib/checkout.sh +++ b/lib/checkout.sh @@ -196,7 +196,7 @@ checkout() local service= service="`get_git_service $1`" if test x"${service}" = x ; then - error "A proper url is required. Call get_URL first." + error "Unable to parse service from '$1'. You have either a bad URL, or an identifier that should be passed to get_URL." return 1 fi diff --git a/testsuite/test.sh b/testsuite/test.sh index a0621778..42f5269d 100755 --- a/testsuite/test.sh +++ b/testsuite/test.sh @@ -1352,6 +1352,40 @@ echo "================================================" # These can be painfully slow so test small repos. +#confirm that checkout works with raw URLs +testing="http://abe.git@staging.git.linaro.org/git/toolchain/abe.git" +in="${testing}" +if test x"${debug}" = xyes; then + out="`cd ${local_snapshots} && checkout ${testing}`" +else + out="`cd ${local_snapshots} && checkout ${testing} 2>/dev/null`" +fi +if test $? -eq 0; then + pass "${testing}" +else + fail "${testing}" +fi + +#confirm that checkout fails approriately with a range of bad services in raw URLs +for service in "foomatic://" "http:" "http:/fake.git" "http/" "http//" ""; do + in="${service}abe.git@staging.git.linaro.org/git/toolchain/abe.git" + testing="checkout: ${in} should fail with 'proper URL required' message." + if test x"${debug}" = xyes; then + out="`cd ${local_snapshots} && checkout ${in} 2> >(tee /dev/stderr)`" + else + out="`cd ${local_snapshots} && checkout ${in} 2>&1`" + fi + if test $? -eq 0; then + fail "${testing}" + else + if echo "${out}" | tail -n1 | grep -q "^ERROR.*: checkout (Unable to parse service from '${in}'\\. You have either a bad URL, or an identifier that should be passed to get_URL\\.)$"; then + pass "${testing}" + else + fail "${testing}" + fi + fi +done + test_checkout () { local should="$1" -- cgit v1.2.3