mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-03 04:30:55 +00:00
Fix risk of popd without a pushd
`pushd` was inside if, `popd` was outside; there was a risk of not doing a `pushd` and only doing a `popd`. Signed-off-by: SkyLined <cojmpjum_github.com@sxd.be>
This commit is contained in:
parent
59e25d0283
commit
fc73cee156
@ -378,14 +378,13 @@ is_repo() {
|
|||||||
pushd "${directory}" &>/dev/null || return 1
|
pushd "${directory}" &>/dev/null || return 1
|
||||||
# Use git to check if the directory is a repo
|
# Use git to check if the directory is a repo
|
||||||
# git -C is not used here to support git versions older than 1.8.4
|
# git -C is not used here to support git versions older than 1.8.4
|
||||||
git status --short &>/dev/null || rc=$?
|
git status --short &> /dev/null || rc=$?
|
||||||
# If the command was not successful,
|
# Move back into the directory the user started in
|
||||||
|
popd &> /dev/null || return 1
|
||||||
else
|
else
|
||||||
# Set a non-zero return code if directory does not exist
|
# Set a non-zero return code if directory does not exist
|
||||||
rc=1
|
rc=1
|
||||||
fi
|
fi
|
||||||
# Move back into the directory the user started in
|
|
||||||
popd &>/dev/null || return 1
|
|
||||||
# Return the code; if one is not set, return 0
|
# Return the code; if one is not set, return 0
|
||||||
return "${rc:-0}"
|
return "${rc:-0}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user