unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* Setting descriptions in manifest.js
@ 2019-06-20 19:00 Konstantin Ryabitsev
  2019-06-21  0:07 ` Eric Wong
  2019-06-23 17:42 ` [PATCH] manifest: v2 epoch descriptions based on inbox->description Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Konstantin Ryabitsev @ 2019-06-20 19:00 UTC (permalink / raw)
  To: meta

Eric:

Grokmirror integration works great, thanks for working on that. I have 
set up a full mirror of lore.kernel.org here:

- https://erol.kernel.org 

Would it be possible to put in list descriptions instead of leaving the 
default value? I'm thinking something like:

if only 0.git:
    0.git.description = list description

if other epochs, too:
    0.git.description = list description [epoch-0]
    1.git.description = list description [epoch-1]
    etc

Best,
-K

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Setting descriptions in manifest.js
  2019-06-20 19:00 Setting descriptions in manifest.js Konstantin Ryabitsev
@ 2019-06-21  0:07 ` Eric Wong
  2019-06-23 17:42 ` [PATCH] manifest: v2 epoch descriptions based on inbox->description Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2019-06-21  0:07 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: meta

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> Eric:
> 
> Grokmirror integration works great, thanks for working on that. I have set
> up a full mirror of lore.kernel.org here:

Good to know!

> - https://erol.kernel.org
> 
> Would it be possible to put in list descriptions instead of leaving the
> default value? I'm thinking something like:
> 
> if only 0.git:
>    0.git.description = list description
> 
> if other epochs, too:
>    0.git.description = list description [epoch-0]
>    1.git.description = list description [epoch-1]
>    etc

Sure, will try to get to it this weekend.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] manifest: v2 epoch descriptions based on inbox->description
  2019-06-20 19:00 Setting descriptions in manifest.js Konstantin Ryabitsev
  2019-06-21  0:07 ` Eric Wong
@ 2019-06-23 17:42 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2019-06-23 17:42 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: meta

The default $GIT_DIR/description (provided by git.git templates)
isn't very useful for v2 epochs, so use the inbox description
and suffix it with the epoch number if it's otherwise unnamed.

Requested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
  https://public-inbox.org/meta/20190620190017.GA27175@chatter.i7.local/
---
 lib/PublicInbox/WwwListing.pm | 14 +++++++++++---
 t/www_listing.t               |  7 ++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index e052bbff..1d4029f0 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -138,8 +138,8 @@ sub fingerprint ($) {
 	$dig->hexdigest;
 }
 
-sub manifest_add ($$;$) {
-	my ($manifest, $ibx, $epoch) = @_;
+sub manifest_add ($$;$$) {
+	my ($manifest, $ibx, $epoch, $default_desc) = @_;
 	my $url_path = "/$ibx->{name}";
 	my $git_dir = $ibx->{mainrepo};
 	if (defined $epoch) {
@@ -155,6 +155,13 @@ sub manifest_add ($$;$) {
 	$owner = undef if $owner eq '';
 	$desc = 'Unnamed repository' if $desc eq '';
 
+	# templates/hooks--update.sample and git-multimail in git.git
+	# only match "Unnamed repository", not the full contents of
+	# templates/this--description in git.git
+	if ($desc =~ /\AUnnamed repository/) {
+		$desc = "$default_desc [epoch $epoch]" if defined($epoch);
+	}
+
 	my $reference;
 	chomp(my $alt = try_cat("$git_dir/objects/info/alternates"));
 	if ($alt) {
@@ -191,8 +198,9 @@ sub js ($$) {
 	my $manifest = { -abs2urlpath => {}, -mtime => 0 };
 	for my $ibx (@$list) {
 		if (defined(my $max = $ibx->max_git_epoch)) {
+			my $desc = $ibx->description;
 			for my $epoch (0..$max) {
-				manifest_add($manifest, $ibx, $epoch);
+				manifest_add($manifest, $ibx, $epoch, $desc);
 			}
 		} else {
 			manifest_add($manifest, $ibx);
diff --git a/t/www_listing.t b/t/www_listing.t
index d82a4a4a..e5b797db 100644
--- a/t/www_listing.t
+++ b/t/www_listing.t
@@ -55,7 +55,12 @@ sub tiny_test {
 		$res->{headers}->{'last-modified'},
 		'modified field and Last-Modified header match');
 
-	ok($manifest->{'/v2/git/0.git'}, 'v2 epoch appeared');
+	ok(my $v2epoch0 = $manifest->{'/v2/git/0.git'}, 'v2 epoch 0 appeared');
+	like($v2epoch0->{description}, qr/ \[epoch 0\]\z/,
+		'epoch 0 in description');
+	ok(my $v2epoch1 = $manifest->{'/v2/git/1.git'}, 'v2 epoch 1 appeared');
+	like($v2epoch1->{description}, qr/ \[epoch 1\]\z/,
+		'epoch 1 in description');
 }
 
 my $pid;
-- 
EW

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-23 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-20 19:00 Setting descriptions in manifest.js Konstantin Ryabitsev
2019-06-21  0:07 ` Eric Wong
2019-06-23 17:42 ` [PATCH] manifest: v2 epoch descriptions based on inbox->description Eric Wong

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).