1. evhan
  2. chicken-git

Commits

evhan  committed 10bac15

define & use shorthand for (oid->pointer (->oid <oid-ish>))

  • Participants
  • Parent commits 4a2fecd
  • Branches master

Comments (0)

Files changed (1)

File git.scm

View file
         ((reference? obj) (reference-target obj))
         (else (object-id obj))))
 
+(define ->oid->pointer
+  (compose oid->pointer ->oid))
+
 (define (->reference-name obj)
   (cond ((string? obj) obj)
         ((reference? obj) (reference-name obj))
     (pointer->object
      (git-object-lookup
       (repository->pointer repo)
-      (oid->pointer (->oid ref))
+      (->oid->pointer ref)
       type))
     ((git) #f)))
 
     (pointer->reference
      (if (not symbolic)
          ;; Direct references are created by OID.
-         (git-reference-create repo* name (oid->pointer (->oid target)) force)
+         (git-reference-create repo* name (->oid->pointer target) force)
          ;; Symbolic references require the target to be given by a string.
          (git-reference-symbolic-create repo* name (->reference-name target) force)))))
 
 (define (reference-target-set! ref target)
   (git-reference-set-target
    (reference->pointer ref)
-   (oid->pointer (->oid target))))
+   (->oid->pointer target)))
 
 (define (reference-rename ref name #!optional force)
   (pointer->reference (git-reference-rename (reference->pointer ref) name force)))
   (pointer->tree
    (git-tree-lookup
     (repository->pointer repo)
-    (oid->pointer (->oid ref)))))
+    (->oid->pointer ref))))
 
 (define (tree-ref tree key)
   (pointer->tree-entry
     (git-tree-builder-insert
      (tree-builder->pointer builder)
      path
-     (oid->pointer (->oid obj))
+     (->oid->pointer obj)
      attributes))))
 
 (define (tree-builder-write repo tb)
   (pointer->commit
    (git-commit-lookup
     (repository->pointer repo)
-    (oid->pointer (->oid ref)))))
+    (->oid->pointer ref))))
 
 (define (commits-fold kons knil repo #!key initial (hide '()) (sort 'none))
   (let ((walker #f))
   (pointer->blob*
    (git-blob*-lookup
     (repository->pointer repo)
-    (oid->pointer (->oid ref)))))
+    (->oid->pointer ref))))
 
 (define (create-blob* repo source)
   (let ((repo* (repository->pointer repo)))
    (git-note-read
     (repository->pointer repo)
     reference
-    (oid->pointer (->oid object)))))
+    (->oid->pointer object))))
 
 (define (delete-note repo #!key target reference author (committer author))
   (git-note-remove
 (define (odb-has-object? odb obj)
   (git-odb-exists
    (odb->pointer odb)
-   (oid->pointer (->oid obj))))
+   (->oid->pointer obj)))
 
 (define (odb-open loc)
   (pointer->odb
   (pointer->odb-object
    (git-odb-read
     (odb->pointer odb)
-    (oid->pointer (->oid obj)))))
+    (->oid->pointer obj))))
 
 (define (odb-write odb data #!optional (type 'blob))
   (pointer->oid (git-odb-write (odb->pointer odb) data (number-of-bytes data) type)))
   (pointer->tag
    (git-tag-lookup
     (repository->pointer repo)
-    (oid->pointer (->oid ref)))))
+    (->oid->pointer ref))))
 
 (define (tags-fold kons knil repo)
   (let ((state knil))