summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2022-06-23 19:05:54 +0530
committerArun Isaac2022-06-23 19:06:40 +0530
commit49163adccd8ca1b60192dd54770e3525f1a2ad97 (patch)
treed687a999fcdcba17d91e7239028c6db34a4cff3e
parente17f83d1d939df299f7377271fdcb0a8057865cd (diff)
downloadtissue-49163adccd8ca1b60192dd54770e3525f1a2ad97.tar.gz
tissue-49163adccd8ca1b60192dd54770e3525f1a2ad97.tar.lz
tissue-49163adccd8ca1b60192dd54770e3525f1a2ad97.zip
git: Add commit-date utility function.
* tissue/git.scm: Import (srfi srfi-19).
(commit-date): New public function.
-rw-r--r--tissue/git.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/tissue/git.scm b/tissue/git.scm
index 944842d..4b7f7c7 100644
--- a/tissue/git.scm
+++ b/tissue/git.scm
@@ -20,6 +20,7 @@
   #:use-module (rnrs arithmetic bitwise)
   #:use-module (rnrs io ports)
   #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-171)
   #:use-module (git)
@@ -40,6 +41,7 @@
   #:use-module (tissue utils)
   #:export (git-top-level
             current-git-repository
+            commit-date
             git-tracked-files))
 
 ;; We bind additional functions from libgit2 that are not already
@@ -182,6 +184,13 @@ repository."
   "Return the current git repository."
   (repository-open (git-top-level)))
 
+(define (commit-date commit)
+  (time-monotonic->date
+   (make-time time-monotonic
+              0
+              (commit-time commit))
+   (* 60 (commit-time-offset commit))))
+
 (define (git-tracked-files repository)
   "Return a list of all files tracked in REPOSITORY. The returned
 filenames are relative to the top-level directory of REPOSITORY and do