1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-08 23:20:56 +00:00

Remove git -C

This commit is contained in:
DL6ER 2016-12-25 21:22:59 +01:00
parent c78d43f640
commit ca056d32d2
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD

24
advanced/Scripts/update.sh Normal file → Executable file
View File

@ -22,9 +22,15 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
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}"
local curdir
local rc
git -C "${directory}" status --short &> /dev/null curdir="${PWD}"
return cd "${directory}" &> /dev/null || return 1
git status --short &> /dev/null
rc=$?
cd "${curdir}" &> /dev/null || return 1
return $rc
} }
prep_repo() { prep_repo() {
@ -46,16 +52,20 @@ make_repo() {
update_repo() { update_repo() {
local directory="${1}" local directory="${1}"
local retVal=0 local curdir
# Pull the latest commits # Pull the latest commits
curdir="${PWD}"
cd "${directory}" &> /dev/null || return 1
# Stash all files not tracked for later retrieval # 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 # 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 # Fetch latest changes and apply
git -C "${directory}" pull --quiet &> /dev/null || ${retVal}=1 git pull --quiet &> /dev/null
return ${retVal} cd "{$curdir}" &> /dev/null || return 1
return
} }
getGitFiles() { getGitFiles() {