We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 43cc544 commit 6855735Copy full SHA for 6855735
scripts/lib.sh
@@ -41,7 +41,17 @@ realpath() {
41
# We have to define realpath before these otherwise it fails on Mac's bash.
42
SCRIPT="${BASH_SOURCE[1]:-${BASH_SOURCE[0]}}"
43
SCRIPT_DIR="$(realpath "$(dirname "$SCRIPT")")"
44
-PROJECT_ROOT="$(cd "$SCRIPT_DIR" && realpath "$(git rev-parse --show-toplevel)")"
+
45
+function project_root {
46
+ dir=$(pwd)
47
48
+ while [[ "$dir" != "" && ! -e "$dir/.git" && ! -e "$dir/.sl" ]]; do
49
+ dir=${dir%/*}
50
+ done
51
52
+ echo "$dir"
53
+}
54
+PROJECT_ROOT="$(cd "$SCRIPT_DIR" && realpath "$(project_root)")"
55
56
# pushd is a silent alternative to the real pushd shell command.
57
pushd() {
0 commit comments