mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-24 12:08:16 +00:00
Merge pull request #1017 from bcambl/ensure_repo_directory
is_repo: ensure directory exists
This commit is contained in:
commit
e4e34acba1
1 changed files with 8 additions and 2 deletions
|
@ -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}"
|
||||||
|
if [ -d $directory ]; then
|
||||||
|
# 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
|
curdir=$PWD; cd $directory; git status --short &> /dev/null; rc=$?; cd $curdir
|
||||||
return $rc
|
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() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue