summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-09-16 15:41:51 +0200
committerGravatar Tom Willemsen2012-09-16 15:41:51 +0200
commit10e7025d6f9621cfc5c7cf5121c410bd1f90c756 (patch)
tree95726912ec20284bf468ae0f210d377317001625
parentbfed5ed044a751254448ed78009e8a8cdffe3270 (diff)
downloadtekuti-10e7025d6f9621cfc5c7cf5121c410bd1f90c756.tar.gz
tekuti-10e7025d6f9621cfc5c7cf5121c410bd1f90c756.zip
Add git-last-update
Checks to see how long ago the last update was, returns a string representing the relative time period.
-rw-r--r--tekuti/git.scm14
1 files changed, 13 insertions, 1 deletions
diff --git a/tekuti/git.scm b/tekuti/git.scm
index 3c9df31..0fe3bd4 100644
--- a/tekuti/git.scm
+++ b/tekuti/git.scm
@@ -41,7 +41,7 @@
git git* ensure-git-repo git-ls-tree git-ls-subdirs
git-mktree git-rev-parse git-hash-object git-update-ref
- git-commit-tree git-rev-list git-revert
+ git-commit-tree git-rev-list git-revert git-last-update
munge-tree munge-tree1 parse-commit commit-utc-timestamp
@@ -191,6 +191,18 @@
(error "bad line2" line2))
(error "bad line1" line1)))))))
+(define* (git-last-update #:optional (git-dir *git-dir*))
+ (let lp ((lines (string-split
+ (git "--git-dir" (expanduser git-dir)
+ "rev-list" "--pretty=format:%ar" "-n" "1" "HEAD")
+ #\newline))
+ (ret '()))
+ (if (or (null? lines)
+ (and (null? (cdr lines)) (string-null? (car lines))))
+ ret
+ (lp (cddr lines)
+ (cadr lines)))))
+
(define (git-hash-object contents)
(string-trim-both
(git* '("hash-object" "-w" "--stdin") #:input contents)))