mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-27 05:28:23 +00:00
Check if directory exists before cd
call for git check.
This commit is contained in:
parent
3163fece31
commit
27a15f0567
1 changed files with 12 additions and 9 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue