Skip to content

Commit

Permalink
Merge pull request #1024 from guillep/issue/1023
Browse files Browse the repository at this point in the history
Issue/1023
  • Loading branch information
guillep authored Oct 31, 2018
2 parents dbfa9be + ebf66bb commit ddc6682
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ libgit: spec
baseline: 'LibGit'
with: [
spec
repository: 'github://pharo-vcs/libgit2-pharo-bindings:v1.5.1';
repository: 'github://pharo-vcs/libgit2-pharo-bindings:v1.5.3';
loads: 'default' ].
spec
project: 'LibGit-Tests'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ processWrapper: spec
configuration: 'ProcessWrapper'
with: [
spec
versionString: #stable;
repository: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo50/main' ]
versionString: '1.2';
repository: 'http://smalltalkhub.com/mc/hernan/ProcessWrapper/main' ]
5 changes: 3 additions & 2 deletions Iceberg-GitCommand.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ runOSSubprocessGitCommand
onExitDo: [ :cmd :outString :errString |
cmd isSuccess
ifTrue: [ ^ outString ]
ifFalse: [ MCFileTreeGitError new signal: 'Git error: ' , (errString ifEmpty: outString) ] ]
ifFalse: [ Error new signal: 'Git error: ' , (errString ifEmpty: outString) ] ]
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ runProcessWrapperGitCommand
(Smalltalk at: #ProcessWrapper ifAbsent: [ self error: 'Please load ProcessWrapper' ])
ifNotNil: [ :pW |
| cmd |
cmd := pW new
useStdout;
useStderr;
startWithCommand:
cmd := pW new.
cmd useStdout.
cmd useStderr.
self assert: (cmd startWithCommand:
self gitCommand , ' -C "'
,
(MCFileTreeFileUtils current directoryPathString: self directory)
, '" ' , aCommandString;
yourself.
, '" ' , aCommandString).
cmd waitForExit.
self assert: cmd isRunning not.
r := cmd upToEnd.
Expand All @@ -33,6 +32,6 @@ runProcessWrapperGitCommand
errorString := cmd errorUpToEnd.
errorString notEmpty
ifTrue:
[ MCFileTreeGitError new signal: 'Git error: ' , errorString ].
[ Error signal: 'Git error: ' , errorString ].
r := '' ] ].
^ r
19 changes: 9 additions & 10 deletions Iceberg-GitCommand.package/IceGitCommand.class/properties.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"category" : "Iceberg-GitCommand",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "NicoPasserini 5/24/2016 11:11",
"super" : "Object",
"category" : "Iceberg-GitCommand",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"directory",
"command" ],
"command"
],
"name" : "IceGitCommand",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
"type" : "normal"
}
3 changes: 1 addition & 2 deletions Iceberg-GitCommand.package/properties.json
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
{
}
{ }
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
API-commiting
commitWithMessage: message andParents: parentCommits

| index |
repository handleLibgitError: [ | signature commitId indexTreeId |
self addToGitIndex.
[ signature := self repositoryHandle defaultSignature ]
on: LGit_GIT_ENOTFOUND, LGit_GIT_ERROR
do: [ :e | IceGitUsernameOrEmailNotFound guessKind: e ifNot: [ e pass ] ].
indexTreeId := self repositoryHandle index writeTreeAndReturnOid.
index := self repositoryHandle index.
indexTreeId := index writeTreeAndReturnOid.
index free.
commitId := (LGitCommitBuilder of: self repositoryHandle)
tree: (LGitTree of: self repositoryHandle fromId: indexTreeId);
message: message withUnixLineEndings utf8Encoded asString "FFI is expecting an string";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ addFilesToIndex: aCollection
"self assert: (self location resolve: each) exists."
each asFileReference path pathString ]
as: Array).
gitIndex writeToDisk]
gitIndex
writeToDisk;
free ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private-libgit
free

(handle isNil or: [ handle isNull ])
ifFalse: [
handle free.
handle := nil ]
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ newRepositoryNamed: projectName withSubdirectory: aSubdirectory
location: self location / projectName;
subdirectory: aSubdirectory;
createNewRepositoryNamed: projectName.
(OSEnvironment current at: 'CI' ifAbsent: [ ]) = 'true'
(OSEnvironment current at: 'CI' ifAbsent: [ 'false' ]) asLowercase = 'true'
ifTrue: [ Transcript
show: 'Setting user information for CI';
cr.
IceGitCommand
in: repository location
execute: {'config' . '--global' . 'user.email' . '"[email protected]"'}.
execute: {'config' . '--global' . 'user.email' . '"[email protected]"'}.
IceGitCommand
in: repository location
execute: {'config' . '--global' . 'user.name' . '"Iceberg CI"'} ].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
initialization
tearDownWithRepository: aRepository

aRepository ifNotNil: [aRepository location ifNotNil: #ensureDeleteAll ].
aRepository ifNotNil: [
aRepository free.
Smalltalk garbageCollect.
aRepository location ifNotNil: #ensureDeleteAll ].
self remoteFileUrl asFileReference ensureDeleteAll
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
running
initialization
initialize
super initialize.
location := FileLocator imageDirectory / 'test' / UUID new asString.
super initialize.
packageName1 := 'IceMockPackage1'.
packageName2 := 'IceMockPackage2'.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
initialization
location

^ FileLocator imageDirectory / 'test'
^ location
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
running
tearDown

Smalltalk garbageCollect.
self location ifNotNil: #ensureDeleteAll.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"packageName1",
"packageName2",
"remoteFileUrl",
"remoteRepository"
"remoteRepository",
"location"
],
"name" : "IceNotYetClonedRepositoryFixture",
"type" : "normal"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
running
isCI
^ (OSEnvironment current at: 'CI' ifAbsent: [ ]) = 'true'
^ (OSEnvironment current at: 'CI' ifAbsent: [ 'false' ]) asLowercase = 'true'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private
ensureDirectoryAtPath: aPathSegments inNode: aNode

| firstChild |
aPathSegments ifEmpty: [ ^ aNode ].
firstChild := self ensureDirectoryNamed: aPathSegments first inNode: aNode.
^ self ensureDirectoryAtPath: aPathSegments allButFirst inNode: firstChild
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
private
ensureDirectoryNamed: aName inNode: aNode

| newNode |
aNode childAt: aName ifPresent: [ :node |
self assert: node value isDirectoryDefinition.
^ node ].
^ aNode addChild: (IceDirectoryDefinition named: aName)
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
private
ensureSourceCodeParentNodeIn: aNode
| codeSubdirectoryPathString |
codeSubdirectoryPathString := diff repository subdirectoryPath pathString.
(codeSubdirectoryPathString isEmpty)
ifTrue: [ ^ aNode ].

aNode childAt: codeSubdirectoryPathString ifPresent: [ :node |
self assert: node value isDirectoryDefinition.
^ node ].
^ aNode addChild: (IceDirectoryDefinition named: codeSubdirectoryPathString)
^ self
ensureDirectoryAtPath: diff repository subdirectoryPath segments
inNode: aNode
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ environment:
CYG_EXE: C:\cygwin\setup-x86.exe
CYG_MIRROR: http://cygwin.mirror.constant.com
SCI_RUN: /cygdrive/c/smalltalkCI-master/bin/smalltalkci
CI: true
matrix:
- SMALLTALK: Pharo-7.0
- SMALLTALK: Pharo-6.1
Expand Down

0 comments on commit ddc6682

Please sign in to comment.