diff options
author | Arun Isaac | 2022-04-06 17:28:08 +0530 |
---|---|---|
committer | Arun Isaac | 2022-04-06 17:28:08 +0530 |
commit | 162176fddbc235c52b40da0dc4d74aae63b2c0d3 (patch) | |
tree | 02549976a3694e78080406a483ee1543a8c3e85f | |
parent | 25104d4422e43b18b7fc4bf17a7ca8440394eda8 (diff) | |
download | tissue-162176fddbc235c52b40da0dc4d74aae63b2c0d3.tar.gz tissue-162176fddbc235c52b40da0dc4d74aae63b2c0d3.tar.lz tissue-162176fddbc235c52b40da0dc4d74aae63b2c0d3.zip |
git: Implement git-top-level independent of the git command.
* tissue/git.scm (git-top-level): Implement independent of the git
command.
-rw-r--r-- | tissue/git.scm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tissue/git.scm b/tissue/git.scm index 50da06b..8be3970 100644 --- a/tissue/git.scm +++ b/tissue/git.scm @@ -25,10 +25,16 @@ git-tracked-files)) (define (git-top-level) - "Return the top-level directory of the current git repository." - (call-with-input-pipe - get-line - "git" "rev-parse" "--show-toplevel")) + "Return the top-level directory of the current git +repository." + (let loop ((curdir (getcwd))) + (cond + ((file-exists? (string-append curdir "/.git")) + curdir) + ((string=? curdir "/") + (error "No git top level found")) + (else + (loop (dirname curdir)))))) (define (git-tracked-files) "Return a list of all files tracked in the current git repository." |