--- a/git/GitRepository.st Sun Sep 30 22:13:12 2012 +0000
+++ b/git/GitRepository.st Tue Oct 02 13:53:10 2012 +0000
@@ -1,10 +1,10 @@
"{ Package: 'stx:libscm/git' }"
GitLibraryObject subclass:#GitRepository
- instanceVariableNames:'path workdir index remotes'
+ instanceVariableNames:'path workdir remotes index'
classVariableNames:''
poolDictionaries:'GitObjectType GitStatusCodes'
- category:'SCM-Git-Model'
+ category:'SCM-Git-Core'
!
@@ -81,6 +81,36 @@
"Created: / 25-09-2012 / 10:48:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+index
+ "Return repository working index"
+
+ index isNil ifTrue:[
+ | ref err |
+
+ ref := ByteArray new: ExternalBytes sizeofPointer.
+ err := GitPrimitives prim_git_repository_index: ref repo: handle.
+ GitError raiseIfError: err.
+ index := GitIndex new
+ setHandleFromRef: ref;
+ setRepository: self;
+ yourself
+ ].
+ ^index
+
+ "Created: / 02-10-2012 / 15:33:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+index: aGitIndex
+ "Sets repository working index to given index"
+
+ self assert: (aGitIndex isKindOf: aGitIndex).
+ index := nil.
+ GitPrimitives prim_git_repository_set_index: handle index: aGitIndex getHandle.
+ index := aGitIndex
+
+ "Created: / 02-10-2012 / 15:33:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
path
^ path
!
@@ -103,10 +133,7 @@
!
workingCopy
- self isBare ifTrue:[
- GitError raiseErrorString: 'Repository is bare'.
- ].
- ^GitWorkingCopy new setRepository: self
+ ^self workingCopyOn: self path
"Created: / 19-09-2012 / 15:32:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
@@ -174,6 +201,7 @@
"pushes all changes to given remote repository"
GitCommand push
+ workingDirectory: self path;
remote: aGitRemote name;
execute
@@ -287,6 +315,12 @@
"Created: / 17-09-2012 / 21:20:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+getIndex
+ ^index
+
+ "Created: / 02-10-2012 / 15:40:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
remoteNamed: name
| ref err |