user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/5] config: support cgit scan-path and scan-hidden-path
  2019-04-05 20:04  6% [PATCH 0/5] a few more cgit compatibility updates Eric Wong
@ 2019-04-05 20:04  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-04-05 20:04 UTC (permalink / raw)
  To: meta

project_list support still needs to be done

And tests need to be written... :<
---
 lib/PublicInbox/Config.pm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 9c1c3e2..9f1e57a 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -208,6 +208,30 @@ sub cgit_repo_merge ($$) {
 	$self->{"coderepo.$nick.cgiturl"} ||= $nick;
 }
 
+sub is_git_dir ($) {
+	my ($git_dir) = @_;
+	-d "$git_dir/objects" && -f "$git_dir/HEAD";
+}
+
+sub scan_path_coderepo {
+	my ($self, $base, $path) = @_;
+	opendir my $dh, $path or return;
+	while (defined(my $dn = readdir $dh)) {
+		next if $dn eq '.' || $dn eq '..';
+		if (index($dn, '.') == 0 && !$self->{-cgit_scan_hidden_path}) {
+			next;
+		}
+		my $nick = $base eq '' ? $dn : "$base/$dn";
+		my $git_dir = "$path/$dn";
+		if (is_git_dir($git_dir)) {
+			my $repo = { url => $nick, path => $git_dir };
+			cgit_repo_merge($self, $repo);
+		} elsif (-d $git_dir) {
+			scan_path_coderepo($self, $nick, $git_dir);
+		}
+	}
+}
+
 sub parse_cgitrc {
 	my ($self, $cgitrc, $nesting) = @_;
 
@@ -235,6 +259,10 @@ sub parse_cgitrc {
 			}
 		} elsif (m!\Ainclude=(.+)\z!) {
 			parse_cgitrc($self, $1, $nesting + 1);
+		} elsif (m!\Ascan-hidden-path=(\d+)\z!) {
+			$self->{-cgit_scan_hidden_path} = $1;
+		} elsif (m!\Ascan-path=(.+)\z!) {
+			scan_path_coderepo($self, '', $1);
 		}
 	}
 	cgit_repo_merge($self, $repo) if $repo;
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] a few more cgit compatibility updates
@ 2019-04-05 20:04  6% Eric Wong
  2019-04-05 20:04  7% ` [PATCH 1/5] config: support cgit scan-path and scan-hidden-path Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-04-05 20:04 UTC (permalink / raw)
  To: meta

This all needs tests, but Works For Me right now...

Eric Wong (5):
  config: support cgit scan-path and scan-hidden-path
  cgit: serve static css, logo, favicon directly
  config: support more cgit directives for project lists
  doc/config: update cgit.cgi scan location
  viewdiff: document constants

 Documentation/public-inbox-config.pod |   2 +-
 lib/PublicInbox/Cgit.pm               |  41 ++++++++++++-
 lib/PublicInbox/Config.pm             | 107 +++++++++++++++++++++++++++++++---
 lib/PublicInbox/GitHTTPBackend.pm     |  62 +++++++++++---------
 lib/PublicInbox/ViewDiff.pm           |   4 ++
 5 files changed, 174 insertions(+), 42 deletions(-)

-- 
EW


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-04-05 20:04  6% [PATCH 0/5] a few more cgit compatibility updates Eric Wong
2019-04-05 20:04  7% ` [PATCH 1/5] config: support cgit scan-path and scan-hidden-path Eric Wong

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

	https://80x24.org/public-inbox.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).