mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Remove git -C
This commit is contained in:
parent
c78d43f640
commit
ca056d32d2
24
advanced/Scripts/update.sh
Normal file → Executable file
24
advanced/Scripts/update.sh
Normal file → Executable file
@ -22,9 +22,15 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||
is_repo() {
|
||||
# Use git to check if directory is currently under VCS, return the value
|
||||
local directory="${1}"
|
||||
local curdir
|
||||
local rc
|
||||
|
||||
git -C "${directory}" status --short &> /dev/null
|
||||
return
|
||||
curdir="${PWD}"
|
||||
cd "${directory}" &> /dev/null || return 1
|
||||
git status --short &> /dev/null
|
||||
rc=$?
|
||||
cd "${curdir}" &> /dev/null || return 1
|
||||
return $rc
|
||||
}
|
||||
|
||||
prep_repo() {
|
||||
@ -46,16 +52,20 @@ make_repo() {
|
||||
|
||||
update_repo() {
|
||||
local directory="${1}"
|
||||
local retVal=0
|
||||
local curdir
|
||||
# Pull the latest commits
|
||||
|
||||
curdir="${PWD}"
|
||||
cd "${directory}" &> /dev/null || return 1
|
||||
# Stash all files not tracked for later retrieval
|
||||
git -C "${directory}" stash --all --quiet &> /dev/null || ${retVal}=1
|
||||
git stash --all --quiet &> /dev/null
|
||||
# Force a clean working directory for cloning
|
||||
git -C "${directory}" clean --force -d &> /dev/null || ${retVal}=1
|
||||
git clean --force -d &> /dev/null
|
||||
# Fetch latest changes and apply
|
||||
git -C "${directory}" pull --quiet &> /dev/null || ${retVal}=1
|
||||
return ${retVal}
|
||||
git pull --quiet &> /dev/null
|
||||
cd "{$curdir}" &> /dev/null || return 1
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
getGitFiles() {
|
||||
|
Loading…
Reference in New Issue
Block a user