Skip to content

Commit e670e03

Browse files
committed
Added updated field to git-index command
1 parent e83d451 commit e670e03

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

lib/chibi/snow/commands.scm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,13 +725,14 @@
725725
(hash (process->pair-or-null 'hash "git rev-parse HEAD"))
726726
(tag (process->pair-or-null 'tag "git describe --exact-match --tags --abbrev=0"))
727727
(url (fix-git-url cfg (process->pair-or-null 'url "git config --get remote.origin.url")))
728-
(git (cons 'git (remove null? (list hash tag url)))))
728+
(git (cons 'git (remove null? (list hash tag url))))
729+
(updated (tai->rfc-3339 (current-second))))
729730
(when (null? hash)
730731
(error "Directory is not a git repository"))
731732
(and pkg
732733
`(,(car pkg)
733734
,git
734-
,@(cdr pkg)))))
735+
,@(cdr pkg) (updated ,updated)))))
735736
(if (pair? pkg-files)
736737
pkg-files
737738
(filter package-file?

lib/chibi/snow/utils.scm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,17 @@
255255
(lp2 (cdr ls2)
256256
(cons (car ls2) seen)
257257
(cons (car ls2) res))))))))))))
258+
259+
(define (tai->rfc-3339 seconds)
260+
(define (pad2 n)
261+
(if (< n 10)
262+
(string-append "0" (number->string n))
263+
(number->string n)))
264+
(let ((tm (seconds->time (exact (round seconds)))))
265+
(string-append
266+
(number->string (+ 1900 (time-year tm))) "-"
267+
(pad2 (+ 1 (time-month tm))) "-"
268+
(pad2 (time-day tm)) "T"
269+
(pad2 (time-hour tm)) ":"
270+
(pad2 (time-minute tm)) ":"
271+
(pad2 (time-second tm)) "+00:00")))

lib/chibi/snow/utils.sld

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
uri-normalize uri-directory
77
version-split version-compare version>? version>=?
88
topological-sort assq-ref
9-
known-implementations impl->version impl->features)
9+
known-implementations impl->version impl->features tai->rfc-3339)
1010
(import (scheme base)
1111
(scheme char)
1212
(scheme file)
@@ -22,7 +22,8 @@
2222
(chibi process)
2323
(chibi string)
2424
(chibi temp-file)
25-
(chibi uri))
25+
(chibi uri)
26+
(chibi time))
2627
(cond-expand
2728
(chibi (import (chibi io)))
2829
(chicken

0 commit comments

Comments
 (0)