Recycle project_root output
This commit is contained in:
@@ -16,8 +16,16 @@ function get_os() {
|
|||||||
|
|
||||||
# For a given file, return its corresponding project root.
|
# For a given file, return its corresponding project root.
|
||||||
function project_root() {
|
function project_root() {
|
||||||
|
set +u
|
||||||
|
if [[ ! -z "${PROJECT_ROOT}" ]]; then
|
||||||
|
echo "$PROJECT_ROOT"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
set -u
|
||||||
|
|
||||||
pushd "$(dirname "$1")" >/dev/null 2>&1 || exit 101
|
pushd "$(dirname "$1")" >/dev/null 2>&1 || exit 101
|
||||||
out=$(git rev-parse --show-toplevel)
|
out=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
ret="$?"
|
ret="$?"
|
||||||
popd >/dev/null 2>&1 || exit 1
|
popd >/dev/null 2>&1 || exit 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user