Better logic for change_to_vcs_root

This commit is contained in:
Dan OBoyle
2015-07-03 17:46:18 -04:00
parent 53c686fc57
commit 96c71e3254

View File

@@ -295,17 +295,13 @@ function enumerate_subdirs() {
# chdir to the base of the repo. # chdir to the base of the repo.
function change_to_vcs_root() { function change_to_vcs_root() {
# if vcs_root not explicitly defined, use $REPOBASE # if vcs_root not explicitly defined, use $REPOBASE
if [[ -z "$1" ]]; then
cd "$REPOBASE"
elif is_blackbox_repo "$1"; then local rbase=${1:-$REPOBASE} # use $1 but if unset use $REPOBASE
cd "$1"
else if ! is_blackbox_repo "$rbase"; then
echo 'ERROR: $1 is not a blackbox Repo' echo "ERROR: $rbase is not a blackbox Repo"
exit 1 exit 1
fi fi
} }
# $1 is a string pointing to a directory. Outputs a # $1 is a string pointing to a directory. Outputs a