about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-01-06 23:58:06 +0000
committerEric Wong <e@80x24.org>2019-01-06 23:59:22 +0000
commiteea76850125119ca79c891f94aa422c96eb25b27 (patch)
tree01d45eaa10b476840b6b5cacef17c6d3e06f28c5
parentc526442ad8f9fddc1b99c0309cfdfbb05a9b582f (diff)
downloadolddoc-eea76850125119ca79c891f94aa422c96eb25b27.tar.gz
Some projects are too lazy to update or upgrade, but cgit/git
URLs are "git clone"-able.
-rw-r--r--lib/oldweb.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/oldweb.rb b/lib/oldweb.rb
index daa5cc5..ccc37f7 100644
--- a/lib/oldweb.rb
+++ b/lib/oldweb.rb
@@ -73,7 +73,19 @@ class Oldweb
     noindex = @old_cfg['noindex'] and noindex.each { |k| ni[k] = true }
     @old_cfg['noindex'] = ni
 
-    if cgit_url = @old_cfg['cgit_url']
+    cgit_url = @old_cfg['cgit_url']
+    source = @old_cfg['source_code'] ||= []
+    if source.empty?
+      if cgit_url
+        source << "git clone #{cgit_url}"
+      end
+      git_url = @old_cfg['git_url']
+      if git_url && git_url != cgit_url
+        source << "git clone #{git_url}"
+      end
+    end
+
+    if cgit_url
       cgit_url += '/tree/%s' # path name
       tag = @git_tag and cgit_url << "id=#{URI.escape(tag)}"
       cgit_url << '#n%d' # lineno