File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,19 @@ realpath() {
41
41
# We have to define realpath before these otherwise it fails on Mac's bash.
42
42
SCRIPT=" ${BASH_SOURCE[1]:- ${BASH_SOURCE[0]} } "
43
43
SCRIPT_DIR=" $( realpath " $( dirname " $SCRIPT " ) " ) "
44
- PROJECT_ROOT=" $( cd " $SCRIPT_DIR " && realpath " $( git rev-parse --show-toplevel) " ) "
44
+
45
+ function project_root {
46
+ # Try to use `git rev-parse --show-toplevel` to find the project root.
47
+ # If this directory is not a git repository, this command will fail.
48
+ git rev-parse --show-toplevel 2> /dev/null && return
49
+
50
+ # This finds the Sapling root. This behavior is added so that @ammario
51
+ # and others can more easily experiment with Sapling, but we do not have a
52
+ # plan to support Sapling across the repo.
53
+ sl root 2> /dev/null && return
54
+ }
55
+
56
+ PROJECT_ROOT=" $( cd " $SCRIPT_DIR " && realpath " $( project_root) " ) "
45
57
46
58
# pushd is a silent alternative to the real pushd shell command.
47
59
pushd () {
You can’t perform that action at this time.
0 commit comments