aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/checkout.sh15
-rwxr-xr-xtestsuite/test.sh18
2 files changed, 27 insertions, 6 deletions
diff --git a/lib/checkout.sh b/lib/checkout.sh
index 83fbb957..81beb2fb 100644
--- a/lib/checkout.sh
+++ b/lib/checkout.sh
@@ -201,18 +201,21 @@ checkout()
fi
local repo=
- repo="`get_git_repo $1`"
+ repo="`get_git_repo $1`" || return 1
+ #None of the following should be able to fail with the code as it is
+ #written today (and failures are therefore untestable) but propagate
+ #errors anyway, in case that situation changes.
local tool=
- tool="`get_toolname $1`"
+ tool="`get_toolname $1`" || return 1
local url=
- url="`get_git_url $1`"
+ url="`get_git_url $1`" || return 1
local branch=
- branch="`get_git_branch $1`"
+ branch="`get_git_branch $1`" || return 1
local revision=
- revision="`get_git_revision $1`"
+ revision="`get_git_revision $1`" || return 1
local srcdir=
- srcdir="`get_srcdir $1`"
+ srcdir="`get_srcdir $1`" || return 1
case $1 in
svn*)
diff --git a/testsuite/test.sh b/testsuite/test.sh
index 42f5269d..adb6dba7 100755
--- a/testsuite/test.sh
+++ b/testsuite/test.sh
@@ -1386,6 +1386,24 @@ for service in "foomatic://" "http:" "http:/fake.git" "http/" "http//" ""; do
fi
done
+#confirm that checkout fails with bad repo - abe is so forgiving that I can only find one suitable input
+in="http://"
+testing="checkout: ${in} should fail with 'cannot parse repo' 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.*: git_parser (Malformed input\\. No repo found\\.)$"; then
+ pass "${testing}"
+ else
+ fail "${testing}"
+ fi
+fi
+
test_checkout ()
{
local should="$1"