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] drop needless `eval {}' around Config->new
@ 2020-04-20  9:33  4% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-04-20  9:33 UTC (permalink / raw)
  To: meta

It hasn't been needed since commit 089cca37fa036411
("config: ignore missing config files").  And we
actually want to propagate errors when we can't
start new processes or if git(1) is missing.
---
 lib/PublicInbox/Admin.pm    | 2 +-
 script/public-inbox-convert | 2 +-
 script/public-inbox-edit    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm
index 336b7d4c..60f4f40d 100644
--- a/lib/PublicInbox/Admin.pm
+++ b/lib/PublicInbox/Admin.pm
@@ -71,7 +71,7 @@ sub resolve_inboxes ($;$$) {
 	my ($argv, $opt, $cfg) = @_;
 	$opt ||= {};
 
-	$cfg //= eval { PublicInbox::Config->new };
+	$cfg //= PublicInbox::Config->new;
 	if ($opt->{all}) {
 		my $cfgfile = PublicInbox::Config::default_file();
 		$cfg or die "--all specified, but $cfgfile not readable\n";
diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index e13c13f4..4c220b36 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -24,7 +24,7 @@ my $old_dir = shift(@ARGV) or die $usage;
 my $new_dir = shift(@ARGV) or die $usage;
 die "$new_dir exists\n" if -d $new_dir;
 die "$old_dir not a directory\n" unless -d $old_dir;
-my $config = eval { PublicInbox::Config->new };
+my $config = PublicInbox::Config->new;
 $old_dir = abs_path($old_dir);
 my $old;
 if ($config) {
diff --git a/script/public-inbox-edit b/script/public-inbox-edit
index 28b1b5e8..42f914a8 100755
--- a/script/public-inbox-edit
+++ b/script/public-inbox-edit
@@ -22,7 +22,7 @@ my @opt = qw(mid|m=s file|F=s raw);
 GetOptions($opt, @PublicInbox::AdminEdit::OPT, @opt) or
 	die "bad command-line args\n$usage\n";
 
-my $cfg = eval { PublicInbox::Config->new };
+my $cfg = PublicInbox::Config->new;
 my $editor = $ENV{MAIL_EDITOR}; # e.g. "mutt -f"
 unless (defined $editor) {
 	my $k = 'publicinbox.mailEditor';

^ permalink raw reply related	[relevance 4%]

* [PATCH] config: ignore missing config files
@ 2019-03-08 22:54  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-03-08 22:54 UTC (permalink / raw)
  To: meta

There's no reason for us to have git-config(1) warn users when a
config file is entirely missing.
---
 lib/PublicInbox/Config.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index da443e5..2ff266f 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -147,6 +147,7 @@ sub default_file {
 sub git_config_dump {
 	my ($file) = @_;
 	my (%section_seen, @section_order);
+	return {} unless -e $file;
 	my @cmd = (qw/git config/, "--file=$file", '-l');
 	my $cmd = join(' ', @cmd);
 	my $fh = popen_rd(\@cmd) or die "popen_rd failed for $file: $!\n";
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-03-08 22:54  7% [PATCH] config: ignore missing config files Eric Wong
2020-04-20  9:33  4% [PATCH] drop needless `eval {}' around Config->new 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).