1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-23 07:18:07 +00:00

is_repo: ensure directory exists

This commit is contained in:
bcambl 2016-12-22 19:57:13 -06:00
parent 9355a8ad0e
commit 513bc32d87

View File

@ -135,8 +135,14 @@ fi
is_repo() { is_repo() {
# Use git to check if directory is currently under VCS, return the value # Use git to check if directory is currently under VCS, return the value
local directory="${1}" local directory="${1}"
curdir=$PWD; cd $directory; git status --short &> /dev/null; rc=$?; cd $curdir if [ -d $directory ]; then
return $rc # git -C is not used here to support git versions older than 1.8.4
curdir=$PWD; cd $directory; git status --short &> /dev/null; rc=$?; cd $curdir
return $rc
else
# non-zero return code if directory does not exist OR is not a valid git repository
return 1
fi
} }
make_repo() { make_repo() {