summaryrefslogtreecommitdiff
path: root/tissue
diff options
context:
space:
mode:
authorArun Isaac2023-01-22 23:39:42 +0000
committerArun Isaac2023-01-23 00:28:12 +0000
commite96b9150993ef5566b5fb9543cb3b9201a26348a (patch)
tree6b98c9d15c7aa955eb9a39b9a27402be85701742 /tissue
parent021f7922702c66d80a4b6f90df39dd0e0baf6d54 (diff)
downloadtissue-e96b9150993ef5566b5fb9543cb3b9201a26348a.tar.gz
tissue-e96b9150993ef5566b5fb9543cb3b9201a26348a.tar.lz
tissue-e96b9150993ef5566b5fb9543cb3b9201a26348a.zip
file-document: Export commits-affecting-file as a utility.
* tissue/file-document.scm (commits-affecting-file): New public function. (read-gemtext-document): Use commits-affecting-file.
Diffstat (limited to 'tissue')
-rw-r--r--tissue/file-document.scm19
1 files changed, 12 insertions, 7 deletions
diff --git a/tissue/file-document.scm b/tissue/file-document.scm
index c29859f..8de9645 100644
--- a/tissue/file-document.scm
+++ b/tissue/file-document.scm
@@ -38,6 +38,7 @@
file-document-created-date
file-document-last-updater
file-document-last-updated-date
+ commits-affecting-file
read-gemtext-document))
(define-class <file-document> (<document>)
@@ -120,6 +121,16 @@ MSet object representing a list of search results."
(memoize-thunk
(cut file-modification-table (current-git-repository))))
+(define (commits-affecting-file file)
+ "Return a list of commits affecting @var{file} in current repository."
+ (map (lambda (commit)
+ (make <commit>
+ #:author (resolve-alias (signature-name (commit-author commit))
+ (%aliases))
+ #:author-date (commit-author-date commit)))
+ (hashtable-ref (file-modification-table-for-current-repository)
+ file #f)))
+
(define (read-gemtext-document file)
"Read gemtext document from @var{file} and return a
@code{<file-document>} object."
@@ -137,10 +148,4 @@ MSet object representing a list of search results."
;; Fallback to filename if document has no title.
file)
#:path file
- #:commits (map (lambda (commit)
- (make <commit>
- #:author (resolve-alias (signature-name (commit-author commit))
- (%aliases))
- #:author-date (commit-author-date commit)))
- (hashtable-ref (file-modification-table-for-current-repository)
- file #f))))
+ #:commits (commits-affecting-file file)))