Browse code
Begin undelta impl
Ed Langley authored on 10/05/2019 07:19:42
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -82,6 +82,9 @@ |
82 | 82 |
(:method ((type (eql :blob)) (s stream) repository) |
83 | 83 |
(chipz:decompress nil (chipz:make-dstate 'chipz:zlib) s)) |
84 | 84 |
|
85 |
+ (:method ((type (eql :tag)) (s stream) repository) |
|
86 |
+ (chipz:decompress nil (chipz:make-dstate 'chipz:zlib) s)) |
|
87 |
+ |
|
85 | 88 |
(:method ((type (eql :tree)) (s stream) repository) |
86 | 89 |
(let* ((data (chipz:decompress nil (chipz:make-dstate 'chipz:zlib) s))) |
87 | 90 |
(tree-entries data)))) |
88 | 91 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
1 |
+(in-package :fwoar.cl-git) |
|
2 |
+ |
|
3 |
+(defun offset-distance (vec) |
|
4 |
+ (+ (loop for v across vec |
|
5 |
+ for sum = (logand 127 v) |
|
6 |
+ then (+ (ash sum 7) |
|
7 |
+ (logand 127 v)) |
|
8 |
+ finally (return sum)) |
|
9 |
+ (loop for x from 1 below 2 |
|
10 |
+ sum (expt 2 (* 7 x))))) |
|
11 |
+ |
|
12 |
+(defun extract-offset-to-base (s) |
|
13 |
+ (offset-distance |
|
14 |
+ (fwoar.bin-parser:extract-high s))) |
|
15 |
+ |
|
16 |
+(defun object-metadata-at-offset (base-position offset s) |
|
17 |
+ (file-position s (- base-position offset)) |
|
18 |
+ (read-object-metadata-from-pack s)) |