Check if directory exists before cd call for git check.

This commit is contained in:
Dan Schaper 2016-10-07 16:41:58 -07:00
parent 3163fece31
commit 27a15f0567

View file

@ -663,15 +663,18 @@ getGitFiles() {
is_repo() {
# If the directory does not have a .git folder it is not a repo
echo -n "::: Checking $1 is a repo..."
cd "$1"
# returns 0 if in git repo, non-zero if not in a repo
git status > /dev/null & spinner $!
if [[ "$?" -eq 0 ]]; then
echo " repository found!"
return 0
fi
echo " repository not found!!"
return 1
if [[ -d "$1" ]] ; then
cd "$1"
# returns 0 if in git repo, non-zero if not in a repo
git status > /dev/null & spinner $!
if [[ "$?" -eq 0 ]]; then
echo " repository found!"
return 0
fi
else
echo " repository not found!!"
return 1
fi
}
make_repo() {