summaryrefslogtreecommitdiff
path: root/git-mirror-cgit
diff options
context:
space:
mode:
Diffstat (limited to 'git-mirror-cgit')
-rwxr-xr-xgit-mirror-cgit13
1 files changed, 7 insertions, 6 deletions
diff --git a/git-mirror-cgit b/git-mirror-cgit
index 8c1b799..3a953b2 100755
--- a/git-mirror-cgit
+++ b/git-mirror-cgit
@@ -23,15 +23,16 @@ class Cgit < GitMirrorBackend
end
@config[key] = val
end
+ return nil
end
def cmd_get_meta(path)
- doc = Nokogiri::HTML(open(@config[url]+path))
- head = open(@config[url]+path+'/HEAD').read
+ doc = Nokogiri::HTML(open(@config['url']+path))
+ head = open(@config['url']+(path+'/HEAD')).read
return {
'description' => doc.css('#header .sub')[0].text,
'owner' => doc.css('#header .sub')[1].text,
- 'default_branch' => head.split("\n")[0].sub(/^ref: /, '').sub(/^refs\/heads\//, ''),
+ 'default-branch' => head.split("\n")[0].sub(/^ref: /, '').sub(/^refs\/heads\//, ''),
}
end
@@ -40,20 +41,20 @@ class Cgit < GitMirrorBackend
end
def urls(path)
- doc = Nokogiri::HTML(open(@config[url]+path))
+ doc = Nokogiri::HTML(open(@config['url']+path))
return doc.css('a[rel="vcs-git"]').map{|a| a['href']}
end
def cmd_push_url(path)
prefs = ['ssh', 'https', 'http', 'git']
- return self.urls.sort_by{|url| prefs.index(url)}
+ return self.urls(path).sort_by{|u| prefs.index(u.split(':', 2)[0])}.first
end
def cmd_pull_url(path)
# prefer https ahead of git because of a bug in git-daemon
# with '~'.
prefs = ['https', 'git', 'http', 'ssh']
- return self.urls.sort_by{|url| prefs.index(url)}
+ return self.urls(path).sort_by{|u| prefs.index(u.split(':', 2)[0])}.first
end
def cmd_repo_mode(path)