threads / patch / 8748

patchAvoid perl in t1300-repo-config

Subject: [PATCH] Avoid perl in t1300-repo-config

## tl;dr

9 messages between Jun 27, 2007 and Jun 28, 2007. Diffs are folded; open one to read it.

replies: 8people: 5as markdown or json

Alex Riesen· Jun 27, 2007, 12:45 UTC · lore

It fixes the test on system where ActiveState Perl is used. It is also shorter.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 t/t1300-repo-config.sh |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
From e844edbdc63150386dc4eb2c2080ece4f371cd04 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Wed, 27 Jun 2007 14:40:41 +0200
Subject: [PATCH] Avoid perl in t1300-repo-config

It fixes the test on system where ActiveState Perl is used. It is shorter as a bonus.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 t/t1300-repo-config.sh |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
Show changes to t/t1300-repo-config.sh +6 −6
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 7a77bef..60b0dc5 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -530,24 +530,24 @@ EOF
 
 cat > expect <<\EOF
 Key: section.sub=section.val1
-Value: foo=bar
+foo=bar
 Key: section.sub=section.val2
-Value: foo
+foo
 bar
 Key: section.sub=section.val3
-Value: 
+
 
 
 Key: section.sub=section.val4
-Value: 
+
 Key: section.sub=section.val5
 EOF
 
-git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result
+git config --null --list | xargs -n1 -0 echo 'Key:' > result
 
 test_expect_success '--null --list' 'cmp result expect'
 
-git config --null --get-regexp 'val[0-9]' | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result
+git config --null --get-regexp 'val[0-9]' | xargs -n1 -0 echo 'Key:' > result
 
 test_expect_success '--null --get-regexp' 'cmp result expect'
 
-- 
1.5.2.2.1308.g540b6
Frank Lichtenheld· Jun 27, 2007, 15:15 UTC · re: Alex Riesen · lore

Re: [PATCH] Avoid perl in t1300-repo-config

On Wed, Jun 27, 2007 at 02:45:40PM +0200, Alex Riesen wrote:
> It fixes the test on system where ActiveState Perl is used.
> It is also shorter.
Thanks :)

For future reference: What in my code broke with ActiveState Perl? The command line options?

Gruesse,
-- 
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/
Alex Riesen· Jun 27, 2007, 15:47 UTC · re: Frank Lichtenheld · lore

Re: [PATCH] Avoid perl in t1300-repo-config

On 6/27/07, Frank Lichtenheld <frank@lichtenheld.de> wrote:
Show 9 quoted lines
> On Wed, Jun 27, 2007 at 02:45:40PM +0200, Alex Riesen wrote:
> > It fixes the test on system where ActiveState Perl is used.
> > It is also shorter.
>
> Thanks :)
>
> For future reference: What in my code broke with ActiveState Perl?
> The command line options?
>

Nothing really, the code is perfect and options are correct. ActiveState is just clueless, and activates \r\n line endings on stdout/stderr by default, unless the stream is binmoded (irrespective of whether the stream is tty or not).

Junio C Hamano· Jun 28, 2007, 04:30 UTC · re: Alex Riesen · lore

Re: [PATCH] Avoid perl in t1300-repo-config

"Alex Riesen" <raa.lkml@gmail.com> writes:
Show 5 quoted lines
> It fixes the test on system where ActiveState Perl is used.
> It is also shorter.
> ...
> -git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result
> +git config --null --list | xargs -n1 -0 echo 'Key:' > result

This now makes us rely on "xargs -0", which is probably much less portable than Perl isn't it? Because the point of the test is that it can show things in NUL terminated format, I'd rather keep it use a bit more portable stuff. Also I am not sure if the two tests are really testing the same thing.

Maybe postprocess "git config -z" output with "tr '[\000]' 'Q'" or something so that the comparison of the result does not have to worry about NULs? I dunno.

By the way, is it possible for gmail users to avoid attachments when sending patches in?

Alex Riesen· Jun 28, 2007, 07:41 UTC · re: Junio C Hamano · lore

Re: [PATCH] Avoid perl in t1300-repo-config

On 6/28/07, Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
> "Alex Riesen" <raa.lkml@gmail.com> writes:
>
> > It fixes the test on system where ActiveState Perl is used.
> > It is also shorter.
> > ...
> > -git config --null --list | perl -0ne 'chop;($key,$value)=...
> > +git config --null --list | xargs -n1 -0 echo 'Key:' > result
>
> This now makes us rely on "xargs -0", which is probably much
> less portable than Perl isn't it?

Dunno. Have yet too meet a system where it doesn't work. That said, SUSv6 does not mention it.

> Maybe postprocess "git config -z" output with "tr '[\000]' 'Q'"
> or something so that the comparison of the result does not have
> to worry about NULs?  I dunno.
Will try that.
> By the way, is it possible for gmail users to avoid attachments
> when sending patches in?
No. The message text is unpredictably garbled
Alex Riesen· Jun 28, 2007, 08:56 UTC · re: Alex Riesen · lore
It fixes the test on systems where ActiveState Perl is used.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 t/t1300-repo-config.sh |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)
On 6/28/07, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 21 quoted lines
> On 6/28/07, Junio C Hamano <gitster@pobox.com> wrote:
> > "Alex Riesen" <raa.lkml@gmail.com> writes:
> >
> > > It fixes the test on system where ActiveState Perl is used.
> > > It is also shorter.
> > > ...
> > > -git config --null --list | perl -0ne 'chop;($key,$value)=...
> > > +git config --null --list | xargs -n1 -0 echo 'Key:' > result
> >
> > This now makes us rely on "xargs -0", which is probably much
> > less portable than Perl isn't it?
>
> Dunno. Have yet too meet a system where it doesn't work.
> That said, SUSv6 does not mention it.
>
> > Maybe postprocess "git config -z" output with "tr '[\000]' 'Q'"
> > or something so that the comparison of the result does not have
> > to worry about NULs?  I dunno.
>
> Will try that.
>

So I did. Any idea as to how make the here-document _without_ the trailing LF?

From 846fcfe47938ee894eb433b6f3a24ae4b6479e5b Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Wed, 27 Jun 2007 14:40:41 +0200
Subject: [PATCH] Avoid perl in t1300-repo-config
It fixes the test on system where ActiveState Perl is used.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 t/t1300-repo-config.sh |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)
Show changes to t/t1300-repo-config.sh +10 −12
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 7a77bef..27486de 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -529,25 +529,23 @@ cat > .git/config <<\EOF
 EOF
 
 cat > expect <<\EOF
-Key: section.sub=section.val1
-Value: foo=bar
-Key: section.sub=section.val2
-Value: foo
-bar
-Key: section.sub=section.val3
-Value: 
+section.sub=section.val1
+foo=barQsection.sub=section.val2
+foo
+barQsection.sub=section.val3
 
 
-Key: section.sub=section.val4
-Value: 
-Key: section.sub=section.val5
+Qsection.sub=section.val4
+Qsection.sub=section.val5Q
 EOF
 
-git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result
+git config --null --list | tr '[\000]' 'Q' > result
+echo >>result
 
 test_expect_success '--null --list' 'cmp result expect'
 
-git config --null --get-regexp 'val[0-9]' | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result
+git config --null --get-regexp 'val[0-9]' | tr '[\000]' 'Q' > result
+echo >>result
 
 test_expect_success '--null --get-regexp' 'cmp result expect'
 
-- 
1.5.2.2.1308.g540b6
Jakub Narebski· Jun 28, 2007, 09:28 UTC · re: Alex Riesen · lore

Re: [PATCH] Avoid perl in t1300-repo-config

Alex Riesen wrote:
>> By the way, is it possible for gmail users to avoid attachments
>> when sending patches in?
> 
> No. The message text is unpredictably garbled

If by "gmail users" you mean gmail web interface, then probably no. No problems with using gmail from email client or from git-send-email (the latter after configuring sendmail in my case).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Alex Riesen· Jun 28, 2007, 11:00 UTC · re: Jakub Narebski · lore

Re: [PATCH] Avoid perl in t1300-repo-config

On 6/28/07, Jakub Narebski <jnareb@gmail.com> wrote:
Show 8 quoted lines
> >> By the way, is it possible for gmail users to avoid attachments
> >> when sending patches in?
> >
> > No. The message text is unpredictably garbled
>
> If by "gmail users" you mean gmail web interface, then probably no.
> No problems with using gmail from email client or from git-send-email
> (the latter after configuring sendmail in my case).
Can't. M$ Exchange plagued
Johannes Schindelin· Jun 28, 2007, 14:19 UTC · re: Alex Riesen · lore

Re: [PATCH] Avoid perl in t1300-repo-config

Hi,
On Thu, 28 Jun 2007, Alex Riesen wrote:
Show 6 quoted lines
> On 6/28/07, Junio C Hamano <gitster@pobox.com> wrote:
> 
> > By the way, is it possible for gmail users to avoid attachments when 
> > sending patches in?
> 
> No. The message text is unpredictably garbled
It is not really unpredictable.
- whitespace at the end of line is stripped
- too long lines are _always_ broken (and our diffstat lines qualify for 
  that)
- empty lines at the end of the message are stripped (does not concern us)
- empty lines at the beginning of the message are stripped (does not 
  concern us either)
- encodings different from UTF-8 are a problem

Of course, the first reason already precludes diffs from being sent. Just think of an empty line, which is in both versions (or even worse, a single space on the line).

Ciao, Dscho

← back to recent threads