Hi Thierry, Providing some feedback here.
I couldn't add a remote repository (image hangs) using Pharo 5. Working with GitHub Bash and SSH connections I think one needs to re-use ssh-agent environment variables before launching git commands. For example if ssh-agent.exe was sucessfully started and MSYS says: $ env | grep ^SSH SSH_AGENT_PID=5784 SSH_AUTH_SOCK=/tmp/ssh-Jpgwx10860/agent.10860 then from CMD.exe one could get both values using: C:\> wmic process where ExecutablePath='c:\\Program Files (x86)\\Git\\bin\\ssh-agent.exe' get ProcessId C:\> find /tmp/ssh-* -name agent.\* -uid $(id -u)|head -n 1 I have attached a change set with some refactorings and new methods to enable setting ssh-agent variables. It is not finished and it needs review. I do not have too much time but is a start, I hope. Cheers, Hernán 2015-10-09 18:35 GMT-03:00 Thierry Goubier <thierry.goub...@gmail.com>: > Hi all, > > thanks to the help of Nicolai and Levente (and others), GitFileTree has > now working support for Windows users through ProcessWrapper (on the > development versions). > > A way for it to work is to have git in your path and simply load: > > Metacello new > configuration: 'GitFileTree'; > version: #'development'; > repository: ' > https://smalltalkhub.com/mc/Pharo/MetaRepoForPharo50/main'; > load > > Expect this to move into stable GitFileTree if it is reported to work. > > Next steps for gitfiletree are a metadata-less mode (for Alexandre :)) and > svn support (aka SVNFileTree ;)). > > Regards, > > Thierry > >
'From Pharo5.0 of 16 April 2015 [Latest update: #50380] on 13 October 2015 at 1:16:17.804323 am'! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/13/2015 01:13'! sshAgentPid " Answer a <String> with the pid of a running ssh-agent process ToDo: if exist '%PROGRAMFILES(X86)%' " ^ self runProcessWrapperCommand: 'wmic process where ExecutablePath=' , '''c:\\Program Files (x86)\\Git\\bin\\ssh-agent.exe ''' , ' get ProcessId' ! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/10/2015 17:05'! processWrapperClass " Answer the ProcessWrapper class or signal an exception if not found " ^ Smalltalk at: #ProcessWrapper ifAbsent: [ self error: 'Please load ProcessWrapper' ]! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/13/2015 01:14'! sshAgentAuthSock " Answer a <String> with the pid of a running ssh-agent process. $SSH_AUTH_SOCK contains the path of the unix file socket that the agent uses for communication with other processes. This is essential for ssh-add. " " '/tmp/ssh-Jpgwx10860/agent.10860' -> '10860' " " find.exe and head.exe (MSYS commands) location should be in PATH environment variable " ^ self runProcessWrapperCommand: 'find /tmp/ssh-* -name agent.\* -uid $(id -u)| head -n 1'! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/13/2015 01:15'! buildProcessWrapperGitCommand: aCommandString in: aDirectory " Answer a <String> with the git command to be used " ^ self buildSSHAgentEnvVars , ' && ' , self gitCommand , ' -C "' , (MCFileTreeFileUtils current directoryPathString: aDirectory) , '" ' , aCommandString! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/10/2015 17:23'! buildSSHAgentEnvVars " Answer a <String> with DOS environment commands for connecting a runnning ssh-agent " ^ String streamContents: [ : stream | stream nextPutAll: 'set SSH_AGENT_PID='; nextPutAll: self sshAgentPid; cr; nextPutAll: 'SSH_AUTH_SOCK='; nextPutAll: self sshAgentAuthSock cr ] ! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/10/2015 16:55'! runProcessWrapperGitCommand: anArrayOfStrings in: aDirectory "Enclose all parameters with double quotes to protect." | r aCommandString | aCommandString := String streamContents: [ :stream | anArrayOfStrings do: [ :e | stream nextPut: $"; nextPutAll: e; nextPutAll: '" ' ] ]. r := self runProcessWrapperGitCommandString: aCommandString in: aDirectory. ^ r! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/10/2015 17:18'! runProcessWrapperGitCommandString: aCommandString in: aDirectory | r command | command := self processWrapperClass new useStdout; useStderr; startWithCommand: (self buildProcessWrapperGitCommand: aCommandString in: aDirectory); yourself. command waitForExit. self assert: command isRunning not. r := command upToEnd. command exitCode > 0 ifTrue: [ self signalGitCommandError: command. r := '' ]. ^ r! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/10/2015 17:00'! signalGitCommandError: command | errorString | errorString := command errorUpToEnd. errorString notEmpty ifTrue: [ MCFileTreeGitError new signal: 'Git error: ' , errorString ]! ! !MCFileTreeGitRepository class methodsFor: 'accessing' stamp: 'HernanMoralesDurand 10/13/2015 01:15'! runProcessWrapperCommand: aCommandString | r command | command := self processWrapperClass new useStdout; useStderr; startWithCommand: aCommandString; yourself. command waitForExit. self assert: command isRunning not. r := command upToEnd. command exitCode > 0 ifTrue: [ self error: command. r := '' ]. ^ r! ! MCFileTreeGitRepository class removeSelector: #buildGitCommand:in:!