summaryrefslogtreecommitdiff
path: root/git-mirror-cgit
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-12-15 16:01:03 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-12-15 16:01:03 -0500
commit71dc3b30449a4574455ff7eb9c390e30ad52ac4a (patch)
tree2f294aeb109bd4049876a598eaf9a43379c1fb90 /git-mirror-cgit
parenta043ff3446cce1e7000cf76bc227f9260199fce3 (diff)
fix (wip)
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)