From 8fb90b9e5eb58bc8e1820f4c8c8fd65bcc0031dd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 18 Dec 2021 01:52:22 +0300 Subject: feat(tools/magrathea): let users override the repository root 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 --- tools/magrathea/mg.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools/magrathea/mg.scm') diff --git a/tools/magrathea/mg.scm b/tools/magrathea/mg.scm index 38447e9303..990fb87f90 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 -- cgit 1.4.1