* [PATCH] Remove dependency on IO::String from Git.pm test
@ 2008-06-18 13:37 Michael Hendricks
2008-06-18 14:46 ` Jakub Narebski
2008-06-19 18:25 ` Lea Wiemann
0 siblings, 2 replies; 10+ messages in thread
From: Michael Hendricks @ 2008-06-18 13:37 UTC (permalink / raw)
To: gitster; +Cc: git, Michael Hendricks
Instead of using IO::String to create an in-memory filehandle, use
open() with a scalar reference as the filename. This feature has been
available since Perl 5.8.0 (which was released in 2002), so it should
be available pretty much everywhere by now.
Signed-off-by: Michael Hendricks <michael@ndrix.org>
---
This patch should apply on top of Junio's lw/perlish branch.
t/t9700/test.pl | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 8318fec..e34c01e 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -9,7 +9,6 @@ use Test::More qw(no_plan);
use Cwd;
use File::Basename;
use File::Temp;
-use IO::String;
BEGIN { use_ok('Git') }
@@ -69,20 +68,21 @@ is($r->ident_person("Name", "email", "123 +0000"), "Name <email>",
# objects and hashes
ok(our $file1hash = $r->command_oneline('rev-parse', "HEAD:file1"), "(get file hash)");
-our $iostring = IO::String->new;
+my $output;
+open our $iostring, '>', \$output;
is($r->cat_blob($file1hash, $iostring), 15, "cat_blob: size");
-is(${$iostring->string_ref}, "changed file 1\n", "cat_blob: data");
+is($output, "changed file 1\n", "cat_blob: data");
our $tmpfile = File::Temp->new();
-print $tmpfile ${$iostring->string_ref};
+print $tmpfile $output;
is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip");
$tmpfile = File::Temp->new();
print $tmpfile my $test_text = "test blob, to be inserted\n";
$tmpfile->close;
like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,
"hash_and_insert_object: returns hash");
-$iostring = IO::String->new;
+open $iostring, '>', \$output;
is($r->cat_blob($newhash, $iostring), length $test_text, "cat_blob: roundtrip size");
-is(${$iostring->string_ref}, $test_text, "cat_blob: roundtrip data");
+is($output, $test_text, "cat_blob: roundtrip data");
# paths
is($r->repo_path, "./.git", "repo_path");
--
1.5.5.23.g2a5fe
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 13:37 [PATCH] Remove dependency on IO::String from Git.pm test Michael Hendricks
@ 2008-06-18 14:46 ` Jakub Narebski
2008-06-18 15:10 ` Rafael Garcia-Suarez
2008-06-18 17:00 ` Johannes Schindelin
2008-06-19 18:25 ` Lea Wiemann
1 sibling, 2 replies; 10+ messages in thread
From: Jakub Narebski @ 2008-06-18 14:46 UTC (permalink / raw)
To: Michael Hendricks; +Cc: gitster, git
Michael Hendricks <michael@ndrix.org> writes:
> Instead of using IO::String to create an in-memory filehandle, use
> open() with a scalar reference as the filename. This feature has been
> available since Perl 5.8.0 (which was released in 2002), so it should
> be available pretty much everywhere by now.
Besides if I understand correctly gitweb very much requires Perl >= 5.8
because of required Unicode support.
Nevertheless adding "use v5.8.0;" or "use 5.008_000;" would be I guess
good idea.
And best solution, although perhaps unnecessary, would be to check
for version >= 5.8, if older check for IO::String, and even if that
fails, simply skip those tests that require in-memory filehandle
(or use tempfile).
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 14:46 ` Jakub Narebski
@ 2008-06-18 15:10 ` Rafael Garcia-Suarez
2008-06-18 17:00 ` Johannes Schindelin
1 sibling, 0 replies; 10+ messages in thread
From: Rafael Garcia-Suarez @ 2008-06-18 15:10 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Michael Hendricks, gitster, git
2008/6/18 Jakub Narebski <jnareb@gmail.com>:
> Michael Hendricks <michael@ndrix.org> writes:
>
>> Instead of using IO::String to create an in-memory filehandle, use
>> open() with a scalar reference as the filename. This feature has been
>> available since Perl 5.8.0 (which was released in 2002), so it should
>> be available pretty much everywhere by now.
>
> Besides if I understand correctly gitweb very much requires Perl >= 5.8
> because of required Unicode support.
>
> Nevertheless adding "use v5.8.0;" or "use 5.008_000;" would be I guess
> good idea.
"use 5.008;" is preferred form; "use v5.8.0" might yield obscure error
messages on perls < 5.6, which is not the desired result.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 14:46 ` Jakub Narebski
2008-06-18 15:10 ` Rafael Garcia-Suarez
@ 2008-06-18 17:00 ` Johannes Schindelin
2008-06-18 17:52 ` Jakub Narebski
2008-06-18 19:13 ` Junio C Hamano
1 sibling, 2 replies; 10+ messages in thread
From: Johannes Schindelin @ 2008-06-18 17:00 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Michael Hendricks, gitster, git
Hi,
On Wed, 18 Jun 2008, Jakub Narebski wrote:
> Michael Hendricks <michael@ndrix.org> writes:
>
> > Instead of using IO::String to create an in-memory filehandle, use
> > open() with a scalar reference as the filename. This feature has been
> > available since Perl 5.8.0 (which was released in 2002), so it should
> > be available pretty much everywhere by now.
>
> Besides if I understand correctly gitweb very much requires Perl >= 5.8
> because of required Unicode support.
Did I miss something? Was this patch not more about Git.pm?
BTW I think it is not nice at all how the dependency hell with Git.pm is
made worse recently.
It is fascinating through how much _pain_ we go with the shell scripts to
maintain portability, even with _very_ old or obscure systems (see the SCO
server patches that came in not long ago!), and just walk over that
portability when it comes to Perl...
Ciao,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 17:00 ` Johannes Schindelin
@ 2008-06-18 17:52 ` Jakub Narebski
2008-06-18 19:35 ` Johannes Schindelin
2008-06-18 19:13 ` Junio C Hamano
1 sibling, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2008-06-18 17:52 UTC (permalink / raw)
To: Johannes Schindelin, Lea Wiemann, Junio Hamano; +Cc: Michael Hendricks, git
On Wed, 18 Jun 2008, Johannes Schindelin wrote:
> On Wed, 18 Jun 2008, Jakub Narebski wrote:
> > Michael Hendricks <michael@ndrix.org> writes:
> >
> > > Instead of using IO::String to create an in-memory filehandle, use
> > > open() with a scalar reference as the filename. This feature has been
> > > available since Perl 5.8.0 (which was released in 2002), so it should
> > > be available pretty much everywhere by now.
> >
> > Besides if I understand correctly gitweb very much requires Perl >= 5.8
> > because of required Unicode support.
>
> Did I miss something? Was this patch not more about Git.pm?
Oops... You are right, my mistake.
For my defense I'd like to point out that the patch this patch is
response to was made by gitweb caching project GSoC student, Lea Wiemann
(who should have been CC-ed, by the way).
> BTW I think it is not nice at all how the dependency hell with Git.pm is
> made worse recently.
It is not dependency for Git.pm, but for Git.pm TEST.
> It is fascinating through how much _pain_ we go with the shell scripts to
> maintain portability, even with _very_ old or obscure systems (see the SCO
> server patches that came in not long ago!), and just walk over that
> portability when it comes to Perl...
And I pointed out how it could be resolved (use 5.8 specific feature,
or IO::String, or skip tests).
--
Jakub Narebski
Poland
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 17:00 ` Johannes Schindelin
2008-06-18 17:52 ` Jakub Narebski
@ 2008-06-18 19:13 ` Junio C Hamano
2008-06-18 19:37 ` Johannes Schindelin
1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2008-06-18 19:13 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jakub Narebski, Michael Hendricks, gitster, git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hi,
>
> On Wed, 18 Jun 2008, Jakub Narebski wrote:
>
>> Michael Hendricks <michael@ndrix.org> writes:
>>
>> > Instead of using IO::String to create an in-memory filehandle, use
>> > open() with a scalar reference as the filename. This feature has been
>> > available since Perl 5.8.0 (which was released in 2002), so it should
>> > be available pretty much everywhere by now.
>>
>> Besides if I understand correctly gitweb very much requires Perl >= 5.8
>> because of required Unicode support.
>
> Did I miss something? Was this patch not more about Git.pm?
>
> BTW I think it is not nice at all how the dependency hell with Git.pm is
> made worse recently.
>
> It is fascinating through how much _pain_ we go with the shell scripts to
> maintain portability, even with _very_ old or obscure systems (see the SCO
> server patches that came in not long ago!), and just walk over that
> portability when it comes to Perl...
Hey, calm down a bit and give me a bit more credit. I am not that stupid.
I've looked at the patch, and it is parked in 'pu', not near 'next'.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 17:52 ` Jakub Narebski
@ 2008-06-18 19:35 ` Johannes Schindelin
2008-06-18 19:42 ` Lea Wiemann
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Schindelin @ 2008-06-18 19:35 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Lea Wiemann, Junio Hamano, Michael Hendricks, git
Hi,
On Wed, 18 Jun 2008, Jakub Narebski wrote:
> On Wed, 18 Jun 2008, Johannes Schindelin wrote:
>
> > BTW I think it is not nice at all how the dependency hell with Git.pm
> > is made worse recently.
>
> It is not dependency for Git.pm, but for Git.pm TEST.
So? Why do you want to break the _test_ on those machines where you need
them most? We _know_ that a release from Junio works fine on Linux.
> > It is fascinating through how much _pain_ we go with the shell scripts
> > to maintain portability, even with _very_ old or obscure systems (see
> > the SCO server patches that came in not long ago!), and just walk over
> > that portability when it comes to Perl...
>
> And I pointed out how it could be resolved (use 5.8 specific feature, or
> IO::String, or skip tests).
I have to point out that the platforms I was speaking of are not know to
make upgrading as easy as Linux. And some of them _do_ come with pretty
old perl. And yes, I had this exact issue (remember when I worked on
removing Git's dependency on Python? That was it. Not enough quota.
Uncooperative admin. Desperate need for a sensible SCM).
In any case, I have to reiterate my point: breaking
backwards-compatibility for _no_ good reason is wrong. I have not looked
at the patch in question, but I seriously doubt that this is the easiest,
most elegant (and yes, backwards-compatible) solution.
Typically, it is not a good sign when you _require_ newer and newer
features and versions of components you use.
Whatever,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 19:13 ` Junio C Hamano
@ 2008-06-18 19:37 ` Johannes Schindelin
0 siblings, 0 replies; 10+ messages in thread
From: Johannes Schindelin @ 2008-06-18 19:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jakub Narebski, Michael Hendricks, git
Hi,
On Wed, 18 Jun 2008, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > It is fascinating through how much _pain_ we go with the shell scripts
> > to maintain portability, even with _very_ old or obscure systems (see
> > the SCO server patches that came in not long ago!), and just walk over
> > that portability when it comes to Perl...
>
> Hey, calm down a bit and give me a bit more credit. I am not that
> stupid. I've looked at the patch, and it is parked in 'pu', not near
> 'next'.
Heh. The part about the shell scripts was actually meant as a genuine
praise. And I did not mean to criticize _you_ for introducing IO::Stream.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 19:35 ` Johannes Schindelin
@ 2008-06-18 19:42 ` Lea Wiemann
0 siblings, 0 replies; 10+ messages in thread
From: Lea Wiemann @ 2008-06-18 19:42 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jakub Narebski, Junio Hamano, Michael Hendricks, git
Johannes Schindelin wrote:
> So? Why do you want to break the _test_ on those machines where you need
> them most? We _know_ that a release from Junio works fine on Linux.
Goodness. Everyone in this thread, please relax a notch. I thought we
had pretty clear agreement that we want to keep Perl 5.6 compatibility
for Git.pm. The solution is to use a temporary file in the current
directory (and unlink it afterwards). If nobody has done that by
tomorrow I'll do it. It'll take that less time than to even read this
thread.
Now lets get back to work.
-- Lea
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Remove dependency on IO::String from Git.pm test
2008-06-18 13:37 [PATCH] Remove dependency on IO::String from Git.pm test Michael Hendricks
2008-06-18 14:46 ` Jakub Narebski
@ 2008-06-19 18:25 ` Lea Wiemann
1 sibling, 0 replies; 10+ messages in thread
From: Lea Wiemann @ 2008-06-19 18:25 UTC (permalink / raw)
To: Michael Hendricks; +Cc: gitster, git
Michael Hendricks wrote:
> Instead of using IO::String to create an in-memory filehandle, use
> open() with a scalar reference as the filename.
I've now sent a new version of my script that uses File::Temp and only
depends on Perl 5.6.2. Thanks for making the start!
Jakub Narebski wrote:
> [...] Lea Wiemann (who should have been CC-ed, by the way).
For the record, CC'ing me or not doesn't make a difference if it's
posted to the list (I don't actually notice whether I'm CC'ed).
-- Lea
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-06-19 18:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-18 13:37 [PATCH] Remove dependency on IO::String from Git.pm test Michael Hendricks
2008-06-18 14:46 ` Jakub Narebski
2008-06-18 15:10 ` Rafael Garcia-Suarez
2008-06-18 17:00 ` Johannes Schindelin
2008-06-18 17:52 ` Jakub Narebski
2008-06-18 19:35 ` Johannes Schindelin
2008-06-18 19:42 ` Lea Wiemann
2008-06-18 19:13 ` Junio C Hamano
2008-06-18 19:37 ` Johannes Schindelin
2008-06-19 18:25 ` Lea Wiemann
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 NNTP newsgroup(s).