X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=build%2Fbranch.sh;h=591213fc4f5dd41cb95950864ee775a584510d76;hb=bd2138b6c03f13675961943325143c714fee81c3;hp=023a3f192ad9e366d03809e91e524dd5407daaca;hpb=5be0be72107f329caec160df3835ab377e8dee2c;p=fs%2Flustre-release.git diff --git a/build/branch.sh b/build/branch.sh index 023a3f1..591213f 100755 --- a/build/branch.sh +++ b/build/branch.sh @@ -12,10 +12,14 @@ parent=$1 child=$2 CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"` dir=${3:-.} +if [ ! -d $dir ]; then + echo >&2 "${progname}: directory '$dir' does not exist." + exit 1 +fi module=$(basename $(<$dir/CVS/Repository)) -if [ "$module" = "lustre" ] ; then - echo >&2 "${progname}: You probably want to branch lustre or portals." +if [ "$module" = "lustre" ]; then + echo >&2 "${progname}: You probably want to branch lustre or lnet." echo >&2 "${progname}: Try using ${0} $parent $child lustre" exit 1 fi @@ -31,9 +35,12 @@ case $child in *) child="b_$child" esac -if test "$parent" != "HEAD" && test -f $dir/CVS/Tag && "`cat $dir/CVS/Tag`" != "T$parent"; then - echo "This script must be run within the $parent branch" - exit 1 +if [ "$parent" != "HEAD" -a -f $dir/CVS/Tag ]; then + # put in separate condition as bash evaluates all conditions unlike C + if [ "`cat $dir/CVS/Tag`" != "T$parent" ]; then + echo "This script must be run within the $parent branch" + exit 1 + fi fi echo parent: $parent CHILD: $CHILD child: $child date: $date