unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH 0/2] lei-related import tweaks
@ 2022-09-02 18:26 Eric Wong
  2022-09-02 18:26 ` [PATCH 1/2] lei/store: do not write info/refs file Eric Wong
  2022-09-02 18:26 ` [PATCH 2/2] import: pass --quiet to `git gc' if STDERR isn't a tty Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2022-09-02 18:26 UTC (permalink / raw)
  To: meta

Just some minor nits I noticed in lei-land...

Eric Wong (2):
  lei/store: do not write info/refs file
  import: pass --quiet to `git gc' if STDERR isn't a tty

 lib/PublicInbox/Import.pm | 7 +++++--
 t/lei_store.t             | 5 ++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

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

* [PATCH 1/2] lei/store: do not write info/refs file
  2022-09-02 18:26 [PATCH 0/2] lei-related import tweaks Eric Wong
@ 2022-09-02 18:26 ` Eric Wong
  2022-09-02 18:26 ` [PATCH 2/2] import: pass --quiet to `git gc' if STDERR isn't a tty Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2022-09-02 18:26 UTC (permalink / raw)
  To: meta

That file is meant for dumb HTTP servers, so avoid wasting two
inodes on something that should never be served for private
email.
---
 lib/PublicInbox/Import.pm | 2 +-
 t/lei_store.t             | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index aef49033..2c8f310a 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -182,8 +182,8 @@ sub _update_git_info ($$) {
 		my $env = { GIT_INDEX_FILE => $index };
 		run_die([@cmd, qw(read-tree -m -v -i), $self->{ref}], $env);
 	}
-	eval { run_die([@cmd, 'update-server-info']) };
 	my $ibx = $self->{ibx};
+	eval { run_die([@cmd, 'update-server-info']) } if $ibx;
 	if ($ibx && $ibx->version == 1 && -d "$ibx->{inboxdir}/public-inbox" &&
 				eval { require PublicInbox::SearchIdx }) {
 		eval {
diff --git a/t/lei_store.t b/t/lei_store.t
index 40ad7800..5a5e5de0 100644
--- a/t/lei_store.t
+++ b/t/lei_store.t
@@ -1,5 +1,5 @@
 #!perl -w
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use v5.10.1;
@@ -149,4 +149,7 @@ EOM
 	is($mset->size, 1, 'rt:1.hour.ago.. works w/ local time');
 }
 
+is_deeply([glob("$store_dir/local/*.git/info/refs")], [],
+	'no info/refs in private lei/store');
+
 done_testing;

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

* [PATCH 2/2] import: pass --quiet to `git gc' if STDERR isn't a tty
  2022-09-02 18:26 [PATCH 0/2] lei-related import tweaks Eric Wong
  2022-09-02 18:26 ` [PATCH 1/2] lei/store: do not write info/refs file Eric Wong
@ 2022-09-02 18:26 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2022-09-02 18:26 UTC (permalink / raw)
  To: meta

No need to pollute non-interactive output for gc use.  This
suppresses notifications from my `lei up --all -q' cronjob.
---
 lib/PublicInbox/Import.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 2c8f310a..04192174 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -192,7 +192,10 @@ sub _update_git_info ($$) {
 		};
 		warn "$ibx->{inboxdir} index failed: $@\n" if $@;
 	}
-	eval { run_die([@cmd, qw(gc --auto)]) } if $do_gc;
+	if ($do_gc) {
+		my @quiet = (-t STDERR ? () : '-q');
+		eval { run_die([@cmd, qw(gc --auto), @quiet]) }
+	}
 }
 
 sub barrier {

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

end of thread, other threads:[~2022-09-02 18:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-02 18:26 [PATCH 0/2] lei-related import tweaks Eric Wong
2022-09-02 18:26 ` [PATCH 1/2] lei/store: do not write info/refs file Eric Wong
2022-09-02 18:26 ` [PATCH 2/2] import: pass --quiet to `git gc' if STDERR isn't a tty 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).