From 49163adccd8ca1b60192dd54770e3525f1a2ad97 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 23 Jun 2022 19:05:54 +0530 Subject: git: Add commit-date utility function. * tissue/git.scm: Import (srfi srfi-19). (commit-date): New public function. --- tissue/git.scm | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- cgit v1.2.3