diff options
author | Andy Wingo | 2012-02-15 22:31:54 +0100 |
---|---|---|
committer | Andy Wingo | 2012-02-15 22:31:54 +0100 |
commit | 085b4c76ef55c5d1470be826d436d3c991982bba (patch) | |
tree | 906fc89b37b0de3ecb98926b03f283fa024f1cdd | |
parent | 8034123827caa8ea3f080907faf28bb405f76417 (diff) | |
download | tekuti-085b4c76ef55c5d1470be826d436d3c991982bba.tar.gz tekuti-085b4c76ef55c5d1470be826d436d3c991982bba.zip |
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).
-rw-r--r-- | tekuti/git.scm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tekuti/git.scm b/tekuti/git.scm index 4bc7d60..3c9df31 100644 --- a/tekuti/git.scm +++ b/tekuti/git.scm @@ -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 |