11require 'redmine/scm/adapters/git_adapter'
22require 'pathname'
33require 'fileutils'
4- require 'open3'
4+ # require 'open3'
5+ require_dependency 'redmine_git_remote/poor_mans_capture3'
56
67class Repository ::GitRemote < Repository ::Git
78
@@ -97,7 +98,7 @@ def ensure_possibly_empty_clone_exists
9798 end
9899
99100 if Dir . exists? clone_path
100- existing_repo_remote , status = Open3 ::capture2 ( "git" , "--git-dir" , clone_path , "config" , "--get" , "remote.origin.url" )
101+ existing_repo_remote , status = RedmineGitRemote :: PoorMansCapture3 ::capture2 ( "git" , "--git-dir" , clone_path , "config" , "--get" , "remote.origin.url" )
101102 return "Unable to run: git --git-dir #{ clone_path } config --get remote.origin.url" unless status . success?
102103
103104 unless two_remotes_equal ( existing_repo_remote , clone_url )
@@ -154,7 +155,7 @@ def fetch
154155 # Checks if host is in ~/.ssh/known_hosts, adds it if not present
155156 def self . add_known_host ( host )
156157 # if not found...
157- out , status = Open3 ::capture2 ( "ssh-keygen" , "-F" , host )
158+ out , status = RedmineGitRemote :: PoorMansCapture3 ::capture2 ( "ssh-keygen" , "-F" , host )
158159 raise "Unable to run 'ssh-keygen -F #{ host } " unless status
159160 unless out . match /found/
160161 # hack to work with 'docker exec' where HOME isn't set (or set to /)
@@ -167,7 +168,7 @@ def self.add_known_host(host)
167168 end
168169
169170 puts "Adding #{ host } to #{ ssh_known_hosts } "
170- out , status = Open3 ::capture2 ( "ssh-keyscan" , host )
171+ out , status = RedmineGitRemote :: PoorMansCapture3 ::capture2 ( "ssh-keyscan" , host )
171172 raise "Unable to run 'ssh-keyscan #{ host } '" unless status
172173 Kernel ::open ( ssh_known_hosts , 'a' ) { |f | f . puts out }
173174 end
0 commit comments