--- a/git/GitRepository.st Fri Sep 07 23:38:22 2012 +0000
+++ b/git/GitRepository.st Mon Sep 10 10:32:46 2012 +0000
@@ -3,7 +3,7 @@
GitHandle subclass:#GitRepository
instanceVariableNames:''
classVariableNames:''
- poolDictionaries:''
+ poolDictionaries:'GitObjectType'
category:'Git-Model'
!
@@ -25,16 +25,8 @@
!GitRepository class methodsFor:'accessing'!
-libraryName
-
- OperatingSystem isUNIXlike ifTrue:[^'libgit2.so'].
-
- OperatingSystem isMSWINDOWSlike ifTrue:[^'git2.dll'].
-
- self error:'Library name for host OS is not known'
-!
-
structSize
+ "Returns size of undelaying structure in bytes"
^0
! !
@@ -47,6 +39,38 @@
"Created: / 08-09-2012 / 00:20:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!GitRepository methodsFor:'lookup'!
+
+lookup: oid
+ "Lookup an object with given OID"
+ ^self lookup: oid type: OBJ_ANY
+
+ "Created: / 10-09-2012 / 10:53:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookup: oid type: typeId
+ "Lookup an object with given OID"
+
+ | ref err type obj |
+
+ oid class == GitOid ifFalse:[
+ self error: 'Passed oid is not a GitOid'.
+ ^nil.
+ ].
+ ref := ByteArray new: ExternalBytes sizeofPointer.
+ err := GitPrimitives prim_git_object_lookup: ref repo: self id: oid type: typeId.
+ err ~~ 0 ifTrue:[
+ self error:'gitlib2 error'
+ ].
+ typeId == OBJ_ANY ifTrue:[
+ obj := ExternalAddress new setAddressFromBytes:ref.
+ type := GitPrimitives prim_git_object_type: obj.
+ ].
+ ^GitObject type: type addressBytes: ref.
+
+ "Created: / 10-09-2012 / 11:01:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!GitRepository class methodsFor:'documentation'!
version_SVN