Skip to content

Commit

Permalink
Compatibility with Redmine 5 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Felip Manyer i Ballester committed Jan 20, 2023
1 parent 7365bc7 commit 7460e5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'redmine'
require_dependency 'redmine_git_mirror/git'
require_dependency 'redmine_git_mirror/ssh'
require_dependency 'redmine_git_mirror/url'
require_dependency 'redmine_git_mirror/settings'
require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/git'
require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/ssh'
require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/url'
require_dependency File.dirname(__FILE__) + '/lib/redmine_git_mirror/settings'

Redmine::Scm::Base.add 'GitMirror'

Expand Down
6 changes: 3 additions & 3 deletions lib/redmine_git_mirror/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class << self

def check_remote_url(url)
url = RedmineGitMirror::URL.parse(url)
RedmineGitMirror::SSH.ensure_host_known(url.host) if url.uses_ssh?
RedmineGitMirror::Ssh.ensure_host_known(url.host) if url.uses_ssh?

_, e = git 'ls-remote', '-h', url.to_s, 'master'
e
Expand All @@ -34,7 +34,7 @@ def prune(path)

def init(clone_path, url)
url = RedmineGitMirror::URL.parse(url)
RedmineGitMirror::SSH.ensure_host_known(url.host) if url.uses_ssh?
RedmineGitMirror::Ssh.ensure_host_known(url.host) if url.uses_ssh?

if Dir.exists? clone_path
o, e = get_remote_url(clone_path)
Expand Down Expand Up @@ -102,7 +102,7 @@ def set_remote_url(clone_path, url)

private def git(*cmd)
s, e, status = Open3.capture3({
'GIT_SSH_COMMAND' => RedmineGitMirror::SSH.command.to_s
'GIT_SSH_COMMAND' => RedmineGitMirror::Ssh.command.to_s
}, GIT_BIN, *cmd)
s.to_s.strip!

Expand Down
2 changes: 1 addition & 1 deletion lib/redmine_git_mirror/ssh.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

module RedmineGitMirror
module SSH
module Ssh
class << self
def ensure_host_known(host)
return unless host
Expand Down

0 comments on commit 7460e5a

Please sign in to comment.