summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-07-04 15:50:46 +0530
committerArun Isaac2022-07-04 17:28:25 +0530
commitb6f24d5222c502e5deb0c9d17eef8255e232e924 (patch)
treedb19376f05097324e4224636cb99b90140ee2f14
parent56f424e05e14ed20038b8b1aa6854705ccc3acd0 (diff)
downloadtissue-b6f24d5222c502e5deb0c9d17eef8255e232e924.tar.gz
tissue-b6f24d5222c502e5deb0c9d17eef8255e232e924.tar.lz
tissue-b6f24d5222c502e5deb0c9d17eef8255e232e924.zip
git: Implement git-top-level in terms of current-git-repository.
* tissue/git.scm (git-top-level): Implement git-top-level in terms of current-git-repository.
-rw-r--r--tissue/git.scm15
1 files changed, 4 insertions, 11 deletions
diff --git a/tissue/git.scm b/tissue/git.scm
index 9e2bf59..3fc8df1 100644
--- a/tissue/git.scm
+++ b/tissue/git.scm
@@ -47,21 +47,14 @@
(proc (diff->pointer diff) %null-pointer)
diff)))
-(define (git-top-level)
- "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 (current-git-repository)
"Return the current git repository."
(repository-open-ext (getcwd) (list)))
+(define (git-top-level)
+ "Return the top-level directory of the current git repository."
+ (dirname (repository-directory (current-git-repository))))
+
(define (head-tree repository)
"Return tree of HEAD in REPOSITORY."
(commit-tree