summaryrefslogtreecommitdiffstatshomepage
path: root/tekuti/git.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tekuti/git.scm')
-rw-r--r--tekuti/git.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/tekuti/git.scm b/tekuti/git.scm
index 0fe3bd4..b17c963 100644
--- a/tekuti/git.scm
+++ b/tekuti/git.scm
@@ -42,6 +42,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-last-update
+ git-latest-commits
munge-tree munge-tree1 parse-commit commit-utc-timestamp
@@ -191,6 +192,23 @@
(error "bad line2" line2))
(error "bad line1" line1)))))))
+(define* (git-latest-commits rev n #:optional (git-dir *git-dir*))
+ (let lp ((lines (string-split
+ (git "--git-dir" (expanduser git-dir)
+ "rev-list" "--pretty=format:%ar\t%s\t%an"
+ "-n" (number->string n) rev) #\newline))
+ (ret '()))
+ (if (or (null? lines)
+ (and (null? (cdr lines)) (string-null? (car lines))))
+ (reverse ret)
+ (lp (cddr lines)
+ (let ((line (cadr lines)))
+ (match-bind
+ "^([^\t]+)\t([^\t]+)\t(.*)$" line (_ sha1 subject author)
+ (cons `(,sha1 ,subject ,author) ret)
+ (error "bad line" line)))))))
+
+
(define* (git-last-update #:optional (git-dir *git-dir*))
(let lp ((lines (string-split
(git "--git-dir" (expanduser git-dir)