Skip to content

Commit

Permalink
chore: even fewer double colons
Browse files Browse the repository at this point in the history
  • Loading branch information
fiddlerwoaroof committed Nov 8, 2023
1 parent 4b9f8a8 commit 98542c6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
3 changes: 2 additions & 1 deletion package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
(:import-from :fwoar.cl-git.commit #:git-commit)
(:import-from :fwoar.cl-git.pack #:packed-ref)
(:export #:ensure-ref #:repository #:*want-delta* #:git-object
#:hash #:*git-encoding* #:git-commit #:ref #:component))
#:hash #:*git-encoding* #:git-commit #:ref #:component
#:*git-repository* #:git-ref #:extract-object))

(defpackage :fwoar.cl-git.types
(:use :cl )
Expand Down
64 changes: 32 additions & 32 deletions tests/git-objects.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
:in :fwoar.cl-git)
(fiveam:in-suite :fwoar.cl-git.git-objects)

(defclass fake-ref (fwoar.cl-git::git-ref)
(defclass fake-ref (fwoar.cl-git:git-ref)
())
(defun fake-ref (repo hash)
(fwoar.lisputils:new 'fake-ref repo hash))

(defmethod fwoar.cl-git::ref ((repo (eql *fake-repo*)) hash)
(defmethod fwoar.cl-git:ref ((repo (eql *fake-repo*)) hash)
(fake-ref repo hash))


(fiveam:def-test basic-commit ()
(let ((fwoar.cl-git::*git-repository* *fake-repo*)
(let ((fwoar.cl-git:*git-repository* *fake-repo*)
(object (fwoar.cl-git::extract-loose-object
nil
(asdf:system-relative-pathname
Expand All @@ -45,7 +45,7 @@
(5am:is (equal '(("author" "L Edgley <[email protected]> 1605513585 -0800")
("committer" "Ed L <[email protected]> 1605513585 -0800")
("tree" "1da546ab4697b719efb62f11fd785d6ad3b226d2"))
(coerce (sort (copy-seq (fwoar.cl-git.commit::metadata object))
(coerce (sort (copy-seq (fwoar.cl-git.commit:metadata object))
'string-lessp
:key 'car)
'list)))))
Expand All @@ -69,27 +69,27 @@
(component :mode entry))))))

(defparameter *fake-repo* :fwoar.cl-git.git-objects.pack)
(defmethod fwoar.cl-git::ref ((repo (eql *fake-repo*)) hash)
(defmethod fwoar.cl-git:ref ((repo (eql *fake-repo*)) hash)
(fake-ref repo hash))
(defmethod fwoar.cl-git::pack-files ((repo (eql *fake-repo*)))
(list
(fwoar.cl-git.pack::pack (asdf:system-relative-pathname
:co.fwoar.cl-git
"tests/sample-git-objects/hello-world-pack.idx")
(asdf:system-relative-pathname
:co.fwoar.cl-git
"tests/sample-git-objects/hello-world-pack.pack")
repo)))
(fwoar.cl-git.pack:pack (asdf:system-relative-pathname
:co.fwoar.cl-git
"tests/sample-git-objects/hello-world-pack.idx")
(asdf:system-relative-pathname
:co.fwoar.cl-git
"tests/sample-git-objects/hello-world-pack.pack")
repo)))

(fiveam:def-test pack-files-commit ()
(let* ((hash "7d7b56a6a64e090041f55293511f48aba6699f1a")
(ref (fwoar.cl-git::packed-ref
(ref (fwoar.cl-git.pack:packed-ref
:fwoar.cl-git.git-objects.pack
hash))
(object (progn (fiveam:is (not (null ref)))
(fiveam:is (equal hash (fwoar.cl-git::ref-hash ref)))
(fiveam:is (equal *fake-repo* (fwoar.cl-git::ref-repo ref)))
(fwoar.cl-git::extract-object ref))))
(fwoar.cl-git:extract-object ref))))

(5am:is (typep object 'fwoar.cl-git:git-commit))
(5am:is (equal "hello, git!
Expand All @@ -103,7 +103,7 @@
(component :committer object)))
(5am:is (equal ()
(component :parents object)))
(let ((fwoar.cl-git::*git-repository* *fake-repo*))
(let ((fwoar.cl-git:*git-repository* *fake-repo*))
(5am:is (equal "1da546ab4697b719efb62f11fd785d6ad3b226d2"
(fwoar.cl-git::ref-hash (component :tree object))))
(5am:is (equal *fake-repo*
Expand All @@ -118,13 +118,13 @@

(fiveam:def-test pack-files-tree ()
(let* ((hash "1da546ab4697b719efb62f11fd785d6ad3b226d2")
(ref (fwoar.cl-git::packed-ref
(ref (fwoar.cl-git.pack:packed-ref
:fwoar.cl-git.git-objects.pack
hash))
(object (progn (fiveam:is (not (null ref)))
(fiveam:is (equal hash (fwoar.cl-git::ref-hash ref)))
(fiveam:is (equal *fake-repo* (fwoar.cl-git::ref-repo ref)))
(fwoar.cl-git::extract-object ref))))
(fwoar.cl-git:extract-object ref))))
(5am:is (typep object 'fwoar.cl-git::git-tree))
(let* ((entries (fwoar.cl-git::entries object))
(entry (progn (5am:is (= (length entries) 1))
Expand All @@ -138,20 +138,20 @@

(fiveam:def-test pack-files-blob ()
(let* ((hash "4b5fa63702dd96796042e92787f464e28f09f17d")
(ref (fwoar.cl-git::packed-ref
(ref (fwoar.cl-git.pack:packed-ref
:fwoar.cl-git.git-objects.pack
hash))
(object (progn (fiveam:is (not (null ref)))
(fiveam:is (equal hash (fwoar.cl-git::ref-hash ref)))
(fiveam:is (equal *fake-repo* (fwoar.cl-git::ref-repo ref)))
(fwoar.cl-git::extract-object ref))))
(fwoar.cl-git:extract-object ref))))
(5am:is (typep object 'fwoar.cl-git::blob))
(5am:is (equal "hello, world
"
(babel:octets-to-string
(fwoar.cl-git::data
(fwoar.cl-git::extract-object
(fwoar.cl-git::packed-ref
(fwoar.cl-git:extract-object
(fwoar.cl-git.pack:packed-ref
:fwoar.cl-git.git-objects.pack
"4b5fa63702dd96796042e92787f464e28f09f17d")))
:encoding :utf-8)))))
Expand All @@ -162,21 +162,21 @@
())
(defun fake-ref-2 (repo hash)
(fwoar.lisputils:new 'fake-ref-2 repo hash))
(defmethod fwoar.cl-git.pack::packed-ref-pack ((ref fake-ref-2))
(defmethod fwoar.cl-git.pack:packed-ref-pack ((ref fake-ref-2))
(let* ((pack-file (asdf:system-relative-pathname
:co.fwoar.cl-git/tests
"tests/sample-git-objects/pack-a0533639fdee4493fdbfc1b701872ace63b95e5f.pack"))
(index-file (asdf:system-relative-pathname
:co.fwoar.cl-git/tests
"tests/sample-git-objects/pack-a0533639fdee4493fdbfc1b701872ace63b95e5f.idx")))
(make-instance 'fwoar.cl-git.pack::pack
(make-instance 'fwoar.cl-git.pack:pack
:repository nil
:index index-file
:pack pack-file)))
(defmethod fwoar.cl-git.pack::packed-ref-offset ((ref fake-ref-2))
(nth-value 1 (fwoar.cl-git.pack::find-sha-in-pack (fwoar.cl-git.pack::packed-ref-pack ref)
(defmethod fwoar.cl-git.pack:packed-ref-offset ((ref fake-ref-2))
(nth-value 1 (fwoar.cl-git.pack::find-sha-in-pack (fwoar.cl-git.pack:packed-ref-pack ref)
(fwoar.cl-git::ref-hash ref))))
(defmethod fwoar.cl-git::ref ((repo (eql *fake-repo-2*)) hash)
(defmethod fwoar.cl-git:ref ((repo (eql *fake-repo-2*)) hash)
(fake-ref-2 repo hash))
(defmethod fwoar.cl-git::pack-files ((repo (eql *fake-repo-2*)))
(list
Expand All @@ -186,7 +186,7 @@
(index-file (asdf:system-relative-pathname
:co.fwoar.cl-git/tests
"tests/sample-git-objects/pack-a0533639fdee4493fdbfc1b701872ace63b95e5f.idx")))
(make-instance 'fwoar.cl-git.pack::pack
(make-instance 'fwoar.cl-git.pack:pack
:repository nil
:index index-file
:pack pack-file))))
Expand All @@ -202,8 +202,8 @@
do (5am:is (equal base-offset
(second
(fwoar.cl-git::base
(fwoar.cl-git::extract-object
(fwoar.cl-git::packed-ref *fake-repo-2* ref)))))))
(fwoar.cl-git:extract-object
(fwoar.cl-git.pack:packed-ref *fake-repo-2* ref)))))))
))

(fiveam:def-test test-pack-roundtrip ()
Expand Down Expand Up @@ -273,7 +273,7 @@
"f03a8d1b4cea085ee9555037d09bca2dbfb990cb")))
(loop for commit in shas
for obj = (fwoar.cl-git.pack::raw-object-for-ref
(fwoar.cl-git::ref :fwoar.cl-git.git-objects.pack-2 commit))
(fwoar.cl-git:ref :fwoar.cl-git.git-objects.pack-2 commit))
do (5am:is (equal (crypto:byte-array-to-hex-string
(crypto:digest-sequence :sha1 obj))
commit)))))
Expand All @@ -291,8 +291,8 @@
(serapeum:vector=
expectations
(fwoar.cl-git::data
(fwoar.cl-git::extract-object
(fwoar.cl-git::packed-ref :fwoar.cl-git.git-objects.pack-2 ref))))))))
(fwoar.cl-git:extract-object
(fwoar.cl-git.pack:packed-ref :fwoar.cl-git.git-objects.pack-2 ref))))))))

(test-ref "87c2b9b2dfaa1fbf66b3fe88d3a925593886b159")

Expand Down

0 comments on commit 98542c6

Please sign in to comment.