From e96b9150993ef5566b5fb9543cb3b9201a26348a Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 22 Jan 2023 23:39:42 +0000 Subject: 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. --- tissue/file-document.scm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tissue') 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 () @@ -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 + #: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{} 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 - #: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))) -- cgit v1.2.3