Skip to content

Commit

Permalink
chore: shuffle stuff around
Browse files Browse the repository at this point in the history
  • Loading branch information
fiddlerwoaroof committed Nov 8, 2023
1 parent dc21e67 commit 1121b09
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
7 changes: 5 additions & 2 deletions co.fwoar.cl-git.asd
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
#:co.fwoar.cl-git)
:serial t
:perform (test-op (o c)
(unless (symbol-call :fiveam '#:run! :fwoar.cl-git)
(error "some tests failed")))
(handler-case
(unless (symbol-call :fiveam '#:run! :fwoar.cl-git)
(error "some tests failed"))
(error (c)
(format t ">>> ~s~%" c))))
:components ((:module "tests"
:components ((:file "tests")
(:file "branch-resolution" :depends-on ("tests"))
Expand Down
2 changes: 1 addition & 1 deletion delta.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

(defun obj-to-type (obj)
(etypecase obj
(git-commit :commit)
(fwoar.cl-git.commit::git-commit :commit)
(git-tree :tree)
(blob :blob)))

Expand Down
5 changes: 5 additions & 0 deletions model.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,8 @@
(hash object))
(defmethod component ((component (eql :hash)) (object git-ref))
(ref-hash object))

(fw.lu:defclass+ blob (fwoar.cl-git::git-object)
((%data :reader data :initarg :data)))
(defmethod -extract-object-of-type ((type (eql :blob)) s repository &key)
(blob s))
7 changes: 5 additions & 2 deletions package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
(:export))
(in-package :fwoar.cl-git.package)

(defpackage :fwoar.cl-git.protocol
(:use :cl)
(:export #:-extract-object-of-type #:component #:defcomponents))

(defpackage :fwoar.cl-git.commit
(:use :cl :fwoar.cl-git.protocol)
(:export #:git-commit))


(defpackage :fwoar.cl-git
(:use :cl )
(:use :cl :fwoar.cl-git.protocol)
(:import-from :fwoar.cl-git.commit #:git-commit)
(:export #:ensure-ref #:repository #:*want-delta* #:git-object
#:hash #:*git-encoding* #:git-commit))
Expand Down
20 changes: 5 additions & 15 deletions protocol.lisp
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
(in-package :fwoar.cl-git)

(defclass+ blob (git-object)
((%data :reader data :initarg :data)))
(in-package :fwoar.cl-git.protocol)

(defgeneric -extract-object-of-type (type s repository &key &allow-other-keys)
(:method :around (type s repository &key hash)
(let ((result (call-next-method)))
(prog1 result
(when (typep result 'git-object)
(setf (hash result) hash)))))
(when (typep result 'fwoar.cl-git::git-object)
(setf (fwoar.cl-git::hash result) hash)))))

(:method ((type (eql :blob)) s repository &key)
(blob s))

(:method ((type (eql :tag)) s repository &key)
s))

(defgeneric component (component object)
(:argument-precedence-order object component)
(:method (component (object git-ref))
(component component (extract-object object)))
(:method (component (object fwoar.cl-git::git-ref))
(component component (fwoar.cl-git::extract-object object)))
(:method ((component sequence) object)
(reduce (lambda (cur next)
(component next cur))
Expand All @@ -38,8 +33,3 @@
,@(loop for (component . component-body) in clauses
collect `(defcomponent ,component
,@component-body))))

(defpackage :fwoar.cl-git.protocol
(:use)
(:import-from :fwoar.cl-git #:-extract-object-of-type #:component #:defcomponents)
(:export #:-extract-object-of-type #:component #:defcomponents))

0 comments on commit 1121b09

Please sign in to comment.