Add git-last-update
Checks to see how long ago the last update was, returns a string representing the relative time period.
This commit is contained in:
parent
bfed5ed044
commit
10e7025d6f
1 changed files with 13 additions and 1 deletions
|
@ -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)))
|
||||
|
|
Loading…
Reference in a new issue