diff options
author | Vincent Ambo <mail@tazj.in> | 2021-12-17T22·52+0300 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-12-18T15·03+0000 |
commit | 8fb90b9e5eb58bc8e1820f4c8c8fd65bcc0031dd (patch) | |
tree | 92fc05cd2a53551096ada4e1ddcf5ec8171a5342 /tools/magrathea/mg.scm | |
parent | 46a4e25550456790999c3afe4a578dedb8fe5024 (diff) |
feat(tools/magrathea): let users override the repository root r/3292
for global installations of magrathea, setting MG_ROOT can be a way to switch quickly between different repositories (esp. in combination with `cd (mg path)`). Change-Id: I4627fe78b7cc112b75ab57e7806ffd85c6d38aee Reviewed-on: https://cl.tvl.fyi/c/depot/+/4396 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'tools/magrathea/mg.scm')
-rw-r--r-- | tools/magrathea/mg.scm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/magrathea/mg.scm b/tools/magrathea/mg.scm index 38447e930324..990fb87f90ba 100644 --- a/tools/magrathea/mg.scm +++ b/tools/magrathea/mg.scm @@ -168,9 +168,10 @@ USAGE (or mg--repository-root (begin (set! mg--repository-root - (string-chomp - (call-with-input-pipe "git rev-parse --show-toplevel" - (lambda (p) (read-string #f p))))) + (or (get-environment-variable "MG_ROOT") + (string-chomp + (call-with-input-pipe "git rev-parse --show-toplevel" + (lambda (p) (read-string #f p)))))) mg--repository-root))) ;; determine the current path relative to the root of the repository |