olddoc user/dev discussion/patches/bugs/etc
 help / color / mirror / code / Atom feed
* [PATCH] fall back to cgit_url and git_url if "source_code" is not defined
@ 2019-01-06 23:59 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-01-06 23:59 UTC (permalink / raw)
  To: olddoc-public

Some projects are too lazy to update or upgrade, but cgit/git
URLs are "git clone"-able.
---
 lib/oldweb.rb | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

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
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-06 23:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-06 23:59 [PATCH] fall back to cgit_url and git_url if "source_code" is not defined Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/olddoc.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).