Re: [[PATCH v2]] Fix bug when more than one readline instance is used
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 11, 2023, 16:05 UTC
- Message-ID
- <xmqqjzu1o97n.fsf@gitster.g>
- In-Reply-To
- <20230811145121.GB2303200@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 15 quoted lines
>> diff --git a/git-svn.perl b/git-svn.perl
>> index e919c3f172..6033b97a0c 100755
>> --- a/git-svn.perl
>> +++ b/git-svn.perl
>> @@ -427,7 +427,7 @@ sub ask {
>> my $default = $arg{default};
>> my $resp;
>> my $i = 0;
>> - term_init() unless $term;
>> + my $term = term_init();
>>
>> if ( !( defined($term->IN)
>> && defined( fileno($term->IN) )
>
> Hmm. Isn't that an indication that git-svn is OK as-is?Yes. As long as we know they share the same kind of code structure to use the same library function that wants its callers to stick to a singleton instance, there is a value in using the same structure on the side of our callers, but yes, we can rely on the global $term for it being a singleton.
> It could still benefit from cleaning up FakeTerm, since we lazily init > the object since 30d45f798d (git-svn: delay term initialization, > 2014-09-14). But I don't think there's a visible bug here with the new > version of Term::ReadLine::Gnu.
True. Let me drop the patch from the 'next down to master fast-track' candidate status.
Thanks.