user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/2] lei_mirror: minor tweaks and fixups
@ 2022-12-12  9:58 Eric Wong
  2022-12-12  9:58 ` [PATCH 1/2] lei_mirror: trim current symlinks from warning Eric Wong
  2022-12-12  9:58 ` [PATCH 2/2] lei_mirror: break circular references Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2022-12-12  9:58 UTC (permalink / raw)
  To: meta

All this stuff still needs tests...

Eric Wong (2):
  lei_mirror: trim current symlinks from warning
  lei_mirror: break circular references

 lib/PublicInbox/LeiMirror.pm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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

* [PATCH 1/2] lei_mirror: trim current symlinks from warning
  2022-12-12  9:58 [PATCH 0/2] lei_mirror: minor tweaks and fixups Eric Wong
@ 2022-12-12  9:58 ` Eric Wong
  2022-12-12  9:58 ` [PATCH 2/2] lei_mirror: break circular references Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2022-12-12  9:58 UTC (permalink / raw)
  To: meta

This quiets needless warnings from current symlinks, while still
complaining about out-of-date ones.
---
 lib/PublicInbox/LeiMirror.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index 33cf55ab..d6d2c69e 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -707,6 +707,7 @@ sub update_ent {
 	}
 	if (my $symlinks = $self->{-ent}->{symlinks}) {
 		my $top = File::Spec->rel2abs($self->{dst});
+		push @{$self->{-new_symlinks}}, @$symlinks;
 		for my $p (@$symlinks) {
 			my $ln = "$top/$p";
 			$ln =~ tr!/!/!s;
@@ -1007,6 +1008,8 @@ sub dump_project_list ($$) {
 	$new{substr($_, 1)} = 1 for keys %$m; # drop leading '/'
 	my @list = sort keys %new;
 	my @remote = grep { !defined($new{$_}) } @list;
+	my %lnk = map { substr($_, 1) => undef } @{$self->{-new_symlinks}};
+	@remote = grep { !exists($lnk{$_}) } @remote;
 
 	warn <<EOM if @remote;
 The following local repositories are ignored/gone from $self->{src}:
@@ -1058,6 +1061,7 @@ sub try_manifest {
 	}
 	local $self->{chg} = {};
 	local $self->{-local_manifest} = load_current_manifest($self);
+	local $self->{-new_symlinks} = [];
 	my ($path_pfx, $n, $multi) = multi_inbox($self, \$path, $m);
 	return $lei->child_error(1, $multi) if !ref($multi);
 	my $v2 = delete $multi->{v2};

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

* [PATCH 2/2] lei_mirror: break circular references
  2022-12-12  9:58 [PATCH 0/2] lei_mirror: minor tweaks and fixups Eric Wong
  2022-12-12  9:58 ` [PATCH 1/2] lei_mirror: trim current symlinks from warning Eric Wong
@ 2022-12-12  9:58 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2022-12-12  9:58 UTC (permalink / raw)
  To: meta

It seems more graceful than dying and breaking a mirror, since
the {reference} in util-linux was irrelevant anyways with the
move to forkgroups.
---
 lib/PublicInbox/LeiMirror.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index d6d2c69e..92156cf1 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -960,9 +960,13 @@ sub clone_all {
 			# resolve multi-level references
 			while ($m && defined($nxt = $m->{$x}->{reference})) {
 				exists($todo->{$nxt}) or last;
-				die <<EOM if ++$nr > 1000;
-E: dependency loop detected (`$x' => `$nxt')
+				if (++$nr > 1000) {
+					$m->{$x}->{reference} = undef;
+					$m->{$nxt}->{reference} = undef;
+					warn <<EOM
+E: dependency loop detected (`$x' => `$nxt'), breaking
 EOM
+				}
 				$x = $nxt;
 			}
 			my $y = delete $todo->{$x} // next; # already done

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

end of thread, other threads:[~2022-12-12  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12  9:58 [PATCH 0/2] lei_mirror: minor tweaks and fixups Eric Wong
2022-12-12  9:58 ` [PATCH 1/2] lei_mirror: trim current symlinks from warning Eric Wong
2022-12-12  9:58 ` [PATCH 2/2] lei_mirror: break circular references 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).