1
0
Fork 0

faster git-rev-parse

* tekuti/git.scm (git-rev-parse): Try to read the ref ourselves, first.
  Fall back to using git if that doesn't work (for example, if it's a
  packed ref).
This commit is contained in:
Andy Wingo 2012-02-15 22:31:54 +01:00
parent 8034123827
commit 085b4c76ef

View file

@ -167,7 +167,11 @@
"\n" 'suffix)))))
(define (git-rev-parse rev)
(string-trim-both (git "rev-parse" rev)))
(or (false-if-exception
(let ((s (string-trim-both (call-with-input-file rev read-line))))
(and (= (string-length s) 40)
s)))
(git "rev-parse" rev)))
(define (git-rev-list rev n)
(let lp ((lines (string-split