Commits

evhan committed 5685f57

add commit-parents convenience function

Comments (0)

Files changed (1)

    commit-message commit-message-encoding
    commit-time commit-time-offset commit-parentcount
    commit-author commit-committer commit-ancestor
-   commit-parent commit-parent-id commit-tree commit-tree-id
+   commit-parent commit-parents commit-parent-id commit-tree commit-tree-id
    blob*? blob* create-blob* blob*-content blob*-size blob*-binary?
    index? index-open index-find index-ref
    index-clear index-add index-remove index-read index-write index-entrycount
     (pointer->commit (git-commit-parent (commit->pointer cmt) n))
     ((git) #f)))
 
+(define (commit-parents c)
+  (let ((n (commit-parentcount c)))
+    (let lp ((i 0)
+             (p '()))
+      (if (= i n)
+          (reverse p)
+          (lp (+ i 1)
+              (cons (commit-parent c i) p))))))
+
 (define (commit-ancestor cmt #!optional (n 1))
   (condition-case
     (pointer->commit (git-commit-nth-gen-ancestor (commit->pointer cmt) n))