--- a/git/GitRepository.st Thu Sep 20 08:22:04 2012 +0000
+++ b/git/GitRepository.st Mon Sep 24 22:43:25 2012 +0000
@@ -1,9 +1,9 @@
"{ Package: 'stx:libscm/git' }"
GitModel subclass:#GitRepository
- instanceVariableNames:'path workdir'
+ instanceVariableNames:'path workdir index'
classVariableNames:''
- poolDictionaries:'GitObjectType'
+ poolDictionaries:'GitObjectType GitStatusCodes'
category:'SCM-Git-Model'
!
@@ -163,6 +163,24 @@
"Created: / 10-09-2012 / 11:01:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!GitRepository methodsFor:'private'!
+
+checkout: object
+ | err stats options |
+ object isGitTreeish ifFalse:[
+ GitError raiseErrorString:'Invalid argument: ', object printString.
+ ^self.
+ ].
+
+ stats := GitIndexerStatsStructure new.
+ options := GitCheckoutOptions new.
+ options strategyCreateMissing.
+ err := GitPrimitives prim_git_checkout_tree: handle treeish: object getHandle opts: options stats: stats.
+ GitError raiseIfError: err.
+
+ "Created: / 19-09-2012 / 09:52:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!GitRepository methodsFor:'private-accessing'!
getHandleClass
@@ -171,6 +189,23 @@
"Created: / 17-09-2012 / 21:20:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+statusOf: aFilename
+ | ref err |
+
+ (aFilename pathName startsWith: self workdir pathName ) ifFalse:[
+ GitError raiseErrorString: 'Given path is within working copy'.
+ ^0.
+ ].
+
+ ref := ByteArray new: ExternalBytes sizeofInt.
+ err := GitPrimitives prim_git_status_file: ref repo: handle path: (aFilename pathName copyFrom: (workdir pathName size + 2)).
+ GitError raiseIfError: err.
+
+ ^ref longAt:1
+
+ "Created: / 24-09-2012 / 22:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
workdir
"Get the path of the working directory for this repository or nil, if
repository is bare"
@@ -200,24 +235,6 @@
"Created: / 10-09-2012 / 19:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!GitRepository methodsFor:'private-operations'!
-
-checkout: object
- | err stats options |
- object isGitTreeish ifFalse:[
- GitError raiseErrorString:'Invalid argument: ', object printString.
- ^self.
- ].
-
- stats := GitIndexerStatsStructure new.
- options := GitCheckoutOptions new.
- options strategyCreateMissing.
- err := GitPrimitives prim_git_checkout_tree: handle treeish: object getHandle opts: options stats: stats.
- GitError raiseIfError: err.
-
- "Created: / 19-09-2012 / 09:52:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
!GitRepository methodsFor:'testing'!
isBare