[PATCH] Avoid perl in t1300-repo-config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It fixes the test on systems where ActiveState Perl is used.

Signed-off-by: Alex Riesen <raa.lkml@xxxxxxxxx>
---
t/t1300-repo-config.sh |   22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)

On 6/28/07, Alex Riesen <raa.lkml@xxxxxxxxx> wrote:
On 6/28/07, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> "Alex Riesen" <raa.lkml@xxxxxxxxx> 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@xxxxxxxxx>
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@xxxxxxxxx>
---
 t/t1300-repo-config.sh |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux