Skip to content

Commit

Permalink
Fixes #100
Browse files Browse the repository at this point in the history
  • Loading branch information
npasserini committed Oct 13, 2016
1 parent 13cfbaf commit 290064a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests - create repository
testCloneOntoExistingDirectory
| location |

location := repository location.
location ensureCreateDirectory.

repository createRepository.
self assert: (location / '.git') exists.

5 changes: 2 additions & 3 deletions Iceberg.package/IceMCGitRepository.class/instance/validate.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
initialize local repository
validate
"TODO: More validations are needed, see: https://github.com/npasserini/iceberg/issues/27."
(self isGitRepository: directory)
ifFalse: [ MCFileTreeGitError new
signal: 'is not a git repository: ' , directory ].
(((self repositoryDirectory / '.git') exists) and: [self isGitRepository: self repositoryDirectory ])
ifFalse: [ MCFileTreeGitError new signal: 'is not a git repository: ' , directory ].
11 changes: 6 additions & 5 deletions Iceberg.package/IceRepository.class/instance/repository..st
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ repository handling
repository: anMCRepository
repository := anMCRepository.

self location exists
(self location exists not or: [ self location hasChildren not ])
ifTrue: [
repository cloneRepository.
repository validate
]
ifFalse: [
repository validate.
branch
ifNil: [ self branchName: repository currentBranch. ]
ifNotNil: [ self checkoutBranch: branch name ]]
ifFalse: [
repository cloneRepository.
repository validate
ifNotNil: [ self checkoutBranch: branch name ]
]

0 comments on commit 290064a

Please sign in to comment.