summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-04-06 17:28:08 +0530
committerArun Isaac2022-04-06 17:28:08 +0530
commit162176fddbc235c52b40da0dc4d74aae63b2c0d3 (patch)
tree02549976a3694e78080406a483ee1543a8c3e85f
parent25104d4422e43b18b7fc4bf17a7ca8440394eda8 (diff)
downloadtissue-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.scm14
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."