mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-27 01:30:18 +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() {
|
is_repo() {
|
||||||
# If the directory does not have a .git folder it is not a repo
|
# If the directory does not have a .git folder it is not a repo
|
||||||
echo -n "::: Checking $1 is a repo..."
|
echo -n "::: Checking $1 is a repo..."
|
||||||
cd "$1"
|
if [[ -d "$1" ]] ; then
|
||||||
# returns 0 if in git repo, non-zero if not in a repo
|
cd "$1"
|
||||||
git status > /dev/null & spinner $!
|
# returns 0 if in git repo, non-zero if not in a repo
|
||||||
if [[ "$?" -eq 0 ]]; then
|
git status > /dev/null & spinner $!
|
||||||
echo " repository found!"
|
if [[ "$?" -eq 0 ]]; then
|
||||||
return 0
|
echo " repository found!"
|
||||||
fi
|
return 0
|
||||||
echo " repository not found!!"
|
fi
|
||||||
return 1
|
else
|
||||||
|
echo " repository not found!!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
make_repo() {
|
make_repo() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue