Handle 'git checkout' error gracefully
This commit is contained in:
parent
5619e94670
commit
c447d7eb9d
1 changed files with 7 additions and 3 deletions
|
@ -19,9 +19,13 @@ change_branch()
|
||||||
branch=$2
|
branch=$2
|
||||||
echo "[-] Attempt to change branch: ${branch}"
|
echo "[-] Attempt to change branch: ${branch}"
|
||||||
doas -u _portzap "${git}" fetch "${remote}" > /dev/null 2>&1
|
doas -u _portzap "${git}" fetch "${remote}" > /dev/null 2>&1
|
||||||
doas -u _portzap "${git}" checkout "${branch}" > /dev/null 2>&1 ||
|
if ! doas -u _portzap "${git}" checkout "${branch}" > /dev/null 2>&1 ||
|
||||||
doas -u _portzap "${git}" checkout -t "${remote}"/"${branch}" > /dev/null 2>&1
|
doas -u _portzap "${git}" checkout -t "${remote}"/"${branch}" > /dev/null 2>&1; then
|
||||||
echo "[-] Done"
|
echo "[-] 'git checkout' exited with an error"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[-] Done"
|
||||||
|
fi
|
||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue