Switch to the stamp directory when running git.

This commit is contained in:
Eli Barzilay 2010-05-20 03:31:19 -04:00
parent 7a380fa160
commit 7424735100

View File

@ -8,7 +8,8 @@
(require racket/system racket/runtime-path)
(define-runtime-path this "stamp.rkt")
(define-runtime-path this-dir ".")
(define-runtime-path this-file "stamp.rkt")
(define stamp
(let ([rx:secs+id #rx"^([0-9]+)\\|([0-9a-f]+|-)\\|(.*?)[ \r\n]*$"])
@ -22,14 +23,15 @@
(and exe
(let ([out (open-output-string)])
(parameterize ([current-output-port out]
[current-error-port out])
[current-error-port out]
[current-directory this-dir])
(system* exe "log" "-1"
"--pretty=format:%ct|%h|g")
(get-output-string out))))))
;; fallback: get the date of this file, no id
(lambda ()
(format "~a|-|f"
(file-or-directory-modify-seconds this))))])
(file-or-directory-modify-seconds this-file))))])
(let* ([x (x)]
[m (and (string? x) (regexp-match rx:secs+id x))]
[d (and m (seconds->date (string->number (cadr m))))])