- Basic simple commit works - timestamp in signatures are messed up, though.
authorvranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
Wed, 26 Sep 2012 06:30:08 +0000
changeset 18 d359fb6d415c
parent 17 f7d026eeca98
child 19 b67bf709cd32
- Basic simple commit works - timestamp in signatures are messed up, though.
git/GitLibraryObject.st
git/GitOid.st
git/GitReference.st
git/GitRepository.st
git/GitSignature.st
git/GitSignatureStructure.st
git/GitTests.st
git/GitWorkingCopy.st
git/git.rc
--- a/git/GitLibraryObject.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitLibraryObject.st	Wed Sep 26 06:30:08 2012 +0000
@@ -76,7 +76,7 @@
 setHandleFromRef: aByteArray
     self assert: aByteArray isByteArray.
     self assert: aByteArray size == ExternalAddress pointerSize.
-    self setHandle: (self getHandleClass newAddress: (aByteArray pointerAt: 1))
+    self setHandle: (self getHandleClass newAddress: (aByteArray longAt: 1))
 
     "Created: / 17-09-2012 / 21:22:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
--- a/git/GitOid.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitOid.st	Wed Sep 26 06:30:08 2012 +0000
@@ -10,6 +10,13 @@
 
 !GitOid class methodsFor:'instance creation'!
 
+fromBytes: aByteArrayOrString
+
+    ^self new replaceBytesFrom: 1 to: 20 with: aByteArrayOrString startingAt: 1
+
+    "Created: / 25-09-2012 / 21:00:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 fromString: aString
 
 "/    | oid |
--- a/git/GitReference.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitReference.st	Wed Sep 26 06:30:08 2012 +0000
@@ -12,7 +12,7 @@
 
 name
     name isNil ifTrue:[
-        name := (GitPrimitives prim_git_reference_name: handle) copyCStringFromHeap 
+        name := (GitPrimitives prim_git_reference_name: handle) 
     ].
     ^name
 
@@ -20,7 +20,7 @@
 !
 
 oid
-    ^GitPrimitives prim_git_reference_oid: handle.
+    ^GitOid fromBytes: (GitPrimitives prim_git_reference_oid: handle).
 
     "Created: / 25-09-2012 / 10:48:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
--- a/git/GitRepository.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitRepository.st	Wed Sep 26 06:30:08 2012 +0000
@@ -61,6 +61,16 @@
     ^0
 ! !
 
+!GitRepository methodsFor:'* As yet uncategorized *'!
+
+setHandleFromRef: aByteArray
+    self assert: aByteArray isByteArray.
+    self assert: aByteArray size == ExternalAddress pointerSize.
+    self setHandle: (self getHandleClass newAddress: (aByteArray longAt: 1))
+
+    "Created: / 25-09-2012 / 20:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !GitRepository methodsFor:'accessing'!
 
 head
@@ -127,7 +137,7 @@
 
     err := GitPrimitives prim_git_commit_create: oid 
                                            repo: handle 
-                                     update_ref: (refOrNil notNil ifTrue:[refOrNil getHandle] ifFalse:[nil]) 
+                                     update_ref: (refOrNil notNil ifTrue:[refOrNil name] ifFalse:[nil]) 
                                          author: author getHandle
                                       committer: committer getHandle
                                message_encoding: 'utf-8'
--- a/git/GitSignature.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitSignature.st	Wed Sep 26 06:30:08 2012 +0000
@@ -86,18 +86,18 @@
 timestamp
 
     (timestamp isNil and:[handle notNil]) ifTrue:[
-        timestamp := Timestamp new osTime: handle time
+        timestamp := Timestamp utcMillisecondsSince1970: handle time 
     ].
     ^timestamp
 
-    "Modified: / 25-09-2012 / 14:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-09-2012 / 22:28:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 timestamp: aTimestamp
 
     timestamp := aTimestamp. 
     handle notNil ifTrue:[
-        handle time: timestamp osTime.
+        handle time: timestamp utcSecondsSince1970.
     ].
     ^timestamp
 
@@ -107,7 +107,7 @@
 !GitSignature methodsFor:'copying'!
 
 copyNow
-    ^self copy timestamp: Timestamp now.
+    ^self copy timestamp: Timestamp now; yourself
 
     "Created: / 25-09-2012 / 14:40:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
--- a/git/GitSignatureStructure.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitSignatureStructure.st	Wed Sep 26 06:30:08 2012 +0000
@@ -73,14 +73,14 @@
 
 time"^ <LargeInteger>"
     
-    ^self longLongAt:1 + 8
+    ^self unsignedLongLongAt:1 + 8 bigEndian:("UninterpretedBytes isBigEndian"true)
 
     "Created: / 25-09-2012 / 14:46:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 time: value"<LargeInteger>"
     
-    ^self longLongAt:1 + 8 put: value
+    ^self unsignedLongLongAt:1 + 8 put: value
 
     "Created: / 25-09-2012 / 14:46:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
--- a/git/GitTests.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitTests.st	Wed Sep 26 06:30:08 2012 +0000
@@ -65,6 +65,7 @@
     self assert: file1_txt isModified.
 
     wc stage.
+    wc commit: 'test_01a commit 1'.
 
     self halt.
 
--- a/git/GitWorkingCopy.st	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/GitWorkingCopy.st	Wed Sep 26 06:30:08 2012 +0000
@@ -22,7 +22,7 @@
 
         index := GitIndex new
             setHandleFromRef: ref;
-            setRepository: self;
+            setRepository: repository;
             yourself
     ].
     ^ index
--- a/git/git.rc	Tue Sep 25 15:48:28 2012 +0000
+++ b/git/git.rc	Wed Sep 26 06:30:08 2012 +0000
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_libscm_git.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,17,17
+  FILEVERSION     6,2,18,18
   PRODUCTVERSION  6,2,3,1
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "eXept Software AG\0"
       VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
-      VALUE "FileVersion", "6.2.17.17\0"
+      VALUE "FileVersion", "6.2.18.18\0"
       VALUE "InternalName", "stx:libscm/git\0"
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2012\nCopyright eXept Software AG 1998-2012\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.3.1\0"
-      VALUE "ProductDate", "Tue, 25 Sep 2012 15:35:28 GMT\0"
+      VALUE "ProductDate", "Wed, 26 Sep 2012 06:29:35 GMT\0"
     END
 
   END