From ca056d32d2c29f90252635b74ece15f14b098bcf Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 25 Dec 2016 21:22:59 +0100 Subject: [PATCH 1/2] Remove git -C --- advanced/Scripts/update.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) mode change 100644 => 100755 advanced/Scripts/update.sh diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh old mode 100644 new mode 100755 index 10728cd8..5459ec04 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -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() { From e50947eb58be3e41079085bbe7caff99c00d9347 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 25 Dec 2016 21:26:06 +0100 Subject: [PATCH 2/2] mend --- advanced/Scripts/update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index 5459ec04..eb6ccd29 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -63,7 +63,7 @@ update_repo() { git clean --force -d &> /dev/null # Fetch latest changes and apply git pull --quiet &> /dev/null - cd "{$curdir}" &> /dev/null || return 1 + cd "${curdir}" &> /dev/null || return 1 return }