summaryrefslogtreecommitdiff
path: root/git-mirror-cgit
diff options
context:
space:
mode:
Diffstat (limited to 'git-mirror-cgit')
-rwxr-xr-xgit-mirror-cgit10
1 files changed, 8 insertions, 2 deletions
diff --git a/git-mirror-cgit b/git-mirror-cgit
index 5e6cfc6..5c56993 100755
--- a/git-mirror-cgit
+++ b/git-mirror-cgit
@@ -33,11 +33,17 @@ class Cgit < GitMirrorBackend
def cmd_get_meta(path)
doc = self.getHTML(path)
- head = open(@config['url']+(path+'/HEAD')).read
+ empty = (doc.css('.error').text == "Repository seems to be empty")
+ if empty
+ default_branch = 'master'
+ else
+ head = open(@config['url']+(path+'/HEAD')).read
+ default_branch = head.split("\n")[0].sub(/^ref: /, '').sub(/^refs\/heads\//, '')
+ end
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' => default_branch,
}
end