Script runs in subshell, no need to cd back to pwd.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
Dan Schaper 2017-03-10 10:57:46 -08:00
parent c3c7dcc9f5
commit 0a0d25dff4
No known key found for this signature in database
GPG Key ID: 572E999E385B7BFC
1 changed files with 3 additions and 9 deletions

View File

@ -33,13 +33,10 @@ fully_fetch_repo() {
get_available_branches(){ get_available_branches(){
# Return available branches # Return available branches
local directory="${1}" local directory="${1}"
local curdir
curdir="${PWD}"
cd "${directory}" || return 1 cd "${directory}" || return 1
# Get reachable remote branches # Get reachable remote branches
git remote show origin | grep 'tracked' | sed 's/tracked//;s/ //g' git remote show origin | grep 'tracked' | sed 's/tracked//;s/ //g'
cd "${curdir}" || return 1
return return
} }
@ -47,14 +44,11 @@ checkout_pull_branch() {
# Check out specified branch # Check out specified branch
local directory="${1}" local directory="${1}"
local branch="${2}" local branch="${2}"
local curdir
curdir="${PWD}"
cd "${directory}" || return 1 cd "${directory}" || return 1
git checkout "${branch}" git checkout "${branch}" || return 1
git pull git pull || return 1
cd "${curdir}" || return 1 return 0
return
} }
warning1() { warning1() {