All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wesley Schwengle <wesleys@opperschaap.net>
To: git@vger.kernel.org
Subject: [[PATCH v2]] Fix bug when more than one readline instance is used
Date: Wed,  9 Aug 2023 21:18:31 -0400	[thread overview]
Message-ID: <20230810011831.1423208-1-wesleys@opperschaap.net> (raw)
In-Reply-To: <20230810004956.GA816605@coredump.intra.peff.net>

A followup[^1] for git-svn.perl on d42e4ca9f8 where this bug was solved
for git-send-email.perl

[^1]: https://lore.kernel.org/git/20230810004956.GA816605@coredump.intra.peff.net/T/#t

Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
---
 git-svn.perl | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index be987e316f..93f6538d61 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -297,27 +297,18 @@ sub _req_svn {
 		{} ],
 );
 
-package FakeTerm;
-sub new {
-	my ($class, $reason) = @_;
-	return bless \$reason, shift;
-}
-sub readline {
-	my $self = shift;
-	die "Cannot use readline on FakeTerm: $$self";
-}
 package main;
 
-my $term;
-sub term_init {
-	$term = eval {
+{
+	my $term;
+	sub term_init {
+		return $term if $term;
 		require Term::ReadLine;
-		$ENV{"GIT_SVN_NOTTY"}
-			? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
-			: new Term::ReadLine 'git-svn';
-	};
-	if ($@) {
-		$term = new FakeTerm "$@: going non-interactive";
+		$term = $ENV{"GIT_SVN_NOTTY"}
+				? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
+				: new Term::ReadLine 'git-svn';
+		};
+		return $term;
 	}
 }
 
-- 
2.42.0.rc0.26.ga73c38ecaa


  reply	other threads:[~2023-08-10  1:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10  0:39 [PATCH] Fix bug when more than one readline instance is used Wesley Schwengle
2023-08-10  0:49 ` Jeff King
2023-08-10  1:18   ` Wesley Schwengle [this message]
2023-08-10 14:31     ` [[PATCH v2]] " Junio C Hamano
2023-08-10 15:14       ` Wesley
2023-08-11  1:01     ` Junio C Hamano
2023-08-11  1:09       ` Wesley
2023-08-11  5:30         ` Junio C Hamano
2023-08-11 14:51           ` Jeff King
2023-08-11 16:05             ` Junio C Hamano
2023-08-30 22:32               ` [PATCH] git-svn: drop FakeTerm hack Junio C Hamano
2023-08-31  0:13                 ` Jeff King
2023-08-31  0:28                   ` Junio C Hamano
2023-08-10  1:05 ` [PATCH] Fix bug when more than one readline instance is used Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230810011831.1423208-1-wesleys@opperschaap.net \
    --to=wesleys@opperschaap.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.