summary refs log tree commit diff
diff options
context:
space:
mode:
-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)))