git.fiddlerwoaroof.com
Browse code

feat: start moving to ref objects instead of strings

Ed L authored on 15/11/2020 01:58:21
Showing 1 changed files
... ...
@@ -129,7 +129,9 @@
129 129
   (branches (repository *git-repository*)))
130 130
 
131 131
 (defun git::parents (commit)
132
-  (alexandria:mappend 'cdr (component :parents commit)))
132
+  (alexandria:mappend (data-lens:<>1 (data-lens:over 'ensure-ref)
133
+                                     #'cdr)
134
+                      (component :parents commit)))
133 135
 (defun git:commit-parents (commit)
134 136
   (git::parents commit))
135 137
 
... ...
@@ -138,7 +140,8 @@
138 140
   (labels ((iterate (queue accum)
139 141
              (if (null queue)
140 142
                  accum
141
-                 (iterate (append (cdr queue)
142
-                                  (git::parents (ensure-ref (car queue))))
143
-                   (cons (car queue) accum)))))
144
-    (iterate (list ref-id) ())))
143
+                 (destructuring-bind (next . rest) queue
144
+                   (iterate (append rest
145
+                                    (git::parents next))
146
+                     (cons next accum))))))
147
+    (iterate (list (ensure-ref ref-id)) ())))