olddoc user/dev discussion/patches/bugs/etc
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: <olddoc-public@80x24.org>
Subject: [PATCH] fall back to cgit_url and git_url if "source_code" is not defined
Date: Sun,  6 Jan 2019 23:59:38 +0000	[thread overview]
Message-ID: <20190106235938.8656-1-e@80x24.org> (raw)

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


                 reply	other threads:[~2019-01-06 23:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://80x24.org/olddoc/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190106235938.8656-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=olddoc-public@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).