diff --git a/tests/Test root contains .urchin./Assess root on a file. b/tests/Test root contains .urchin./Assess root on a file. new file mode 100755 index 0000000..2d1e98f --- /dev/null +++ b/tests/Test root contains .urchin./Assess root on a file. @@ -0,0 +1,3 @@ +#!/bin/sh +#!/bin/sh +../../urchin --root .testsuite/a/b/c/testcase diff --git a/tests/Test root contains .urchin./Wrong filename b/tests/Test root contains .urchin./Wrong filename new file mode 100755 index 0000000..1a21f12 --- /dev/null +++ b/tests/Test root contains .urchin./Wrong filename @@ -0,0 +1,2 @@ +#!/bin/sh +../../urchin --root .testsuite/a/not-a-file diff --git a/urchin b/urchin index 604ec6e..28053e7 100755 --- a/urchin +++ b/urchin @@ -19,10 +19,13 @@ VERSION=0.0.6 urchin_root() { ( set -e - if test -f "$1"; then - set -- $(dirname "$1") - fi - if test -d "$1"/.urchin; then + + if ! test -e "$1"; then + echo "$1: No such file or directory">&2 + exit 1 + elif test -f "$1"; then + urchin_root $(dirname "$1") + elif test -d "$1"/.urchin; then echo "$1" elif test "$(readlink -f $1)" = /; then guess=$(readlink -f "$1"|sed s+\(/tests?/\).*+/tests/+)