Commits

evhan committed 01128eb

commit-create fix, repo-ref returns #f if not found

  • Participants
  • Parent commits 5907a7f
  • Tags 0.0.3

Comments (0)

Files changed (5)

File git-lolevel.scm

     (guard-errors commit-create
       ((foreign-lambda int git_commit_create_o
          oid repository c-string signature signature c-string tree int              pointer-vector)
-         id  repo       ref      author    commit    msg      tree (length parents) (apply pointer-vector
-                                                                                      (append parents #f))))
+         id  repo       ref      author    commit    msg      tree (length parents) (apply pointer-vector parents)))
     id))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

File git.release-info

 (repo git "git://github.com/evhan/{egg-name}.git")
 (uri targz "https://github.com/evhan/{egg-name}/tarball/{egg-release}")
-(release "0.0.2")
+(release "0.0.3")
 (define repository-empty? repository-is-empty)
 (define repository-bare? repository-is-bare)
 
-(define (repository-open path)
+(define (repository-open #!optional (path "."))
   ;; Try opening path as a "normal" repo first
   ;; (i.e. a workdir with a '.git' directory),
   ;; and if that doesn't work try as a "bare" repo.
   (git-repository-path (repository->pointer repo) type))
 
 (define (repository-ref repo ref #!optional (type 'any))
-  (pointer->object
-    (git-object-lookup
-      (repository->pointer repo)
-      (oid->pointer (->oid ref))
-      type)))
+  (condition-case
+    (pointer->object
+      (git-object-lookup
+        (repository->pointer repo)
+        (oid->pointer (->oid ref))
+        type))
+    ((git) #f)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; References
              (lp (cons (git-revwalk-next walker) acc))
              ((git) acc))))))
 
-(define (create-commit repo #!key tree parents message author (committer author) (reference #f))
+(define (create-commit repo #!key tree message (parents '()) author (committer author) (reference #f))
   (commit repo
     (pointer->oid
       (apply git-commit-create
 (install-extension 'git
   '("git-lolevel.so" "git-lolevel.import.so"
     "git.so" "git.import.so")
-  '((version "0.0.2")))
+  '((version "0.0.3")))
 ==== Repository
 
 <record>repository</record>
-<procedure>(repository-open path)              => repository</procedure>
+<procedure>(repository-open [path])            => repository</procedure>
 <procedure>(repository-path repository [type]) => string</procedure>
 <procedure>(repository-ref repository ref)     => object</procedure>
 <procedure>(repository-empty? repository)      => boolean</procedure>
 <procedure>(commit-author commit)                     => signature</procedure>
 <procedure>(commit-committer commit)                  => signature</procedure>
 <procedure>(commit-parent commit [n])                 => commit</procedure>
-<procedure>(create-commit repository tree parents message author [committer] [reference]) => commit</procedure>
+<procedure>(create-commit repository tree message [parents] author [committer] [reference]) => commit</procedure>
 
 ==== Tag
 
 <procedure>(tree-id tree)                 => oid</procedure>
 <procedure>(tree-entrycount tree)         => int</procedure>
 <procedure>(tree-ref tree key)            => tree-entry</procedure>
-<procedure>(tree->list tree)              => list</procedure>
+<procedure>(tree->list tree [repo])       => list</procedure>
 <procedure>(create-tree repository index) => tree</procedure>
 
 ==== Tree Entry