git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make t8001-annotate and t8002-blame more portable
@ 2006-06-18 20:33 Dennis Stosberg
  2006-06-18 20:58 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Dennis Stosberg @ 2006-06-18 20:33 UTC (permalink / raw)
  To: git

These two tests assume that "sed" will not modify the final line of a
stream if it does not end with a newline character.  The assumption is
not true at least for FreeBSD and Solaris 9.  FreeBSD's "sed" appends
a newline character; "sed" in Solaris 9 even removes the incomplete
final line.  This patch makes the test use perl instead.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 t/annotate-tests.sh |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index 114938c..71d0f30 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -111,9 +111,7 @@ test_expect_success \
 
 test_expect_success \
     'some edit' \
-    'mv file file1 &&
-     sed -e 1d -e "5s/3A/99/" file1 >file &&
-     rm -f file1 &&
+    'perl -pi -e "s/^1A.*\n$//; s/^3A/99/" file &&
     GIT_AUTHOR_NAME="D" git commit -a -m "edit"'
 
 test_expect_success \
-- 
1.4.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make t8001-annotate and t8002-blame more portable
  2006-06-18 20:33 [PATCH] Make t8001-annotate and t8002-blame more portable Dennis Stosberg
@ 2006-06-18 20:58 ` Junio C Hamano
  2006-06-18 22:06   ` Dennis Stosberg
  2006-06-19 16:35   ` Alex Riesen
  0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2006-06-18 20:58 UTC (permalink / raw)
  To: Dennis Stosberg; +Cc: git

Dennis Stosberg <dennis@stosberg.net> writes:

> These two tests assume that "sed" will not modify the final line of a
> stream if it does not end with a newline character.  The assumption is
> not true at least for FreeBSD and Solaris 9.  FreeBSD's "sed" appends
> a newline character; "sed" in Solaris 9 even removes the incomplete
> final line.

Gaaah.

> -    'mv file file1 &&
> -     sed -e 1d -e "5s/3A/99/" file1 >file &&
> -     rm -f file1 &&
> +    'perl -pi -e "s/^1A.*\n$//; s/^3A/99/" file &&
>      GIT_AUTHOR_NAME="D" git commit -a -m "edit"'

The first line in the original is removed while the perl version
seems to just makes it empty -- ah, you remove the trailing LF
as well there.  I've never seen this done like this, but OK.

It would have been more obvious if it were written like this:

	$_ = "" if ($. == 1);

but probably it is just me.

Thanks for the patch.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make t8001-annotate and t8002-blame more portable
  2006-06-18 20:58 ` Junio C Hamano
@ 2006-06-18 22:06   ` Dennis Stosberg
  2006-06-18 22:21     ` Junio C Hamano
  2006-06-19 16:35   ` Alex Riesen
  1 sibling, 1 reply; 6+ messages in thread
From: Dennis Stosberg @ 2006-06-18 22:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:

> > +    'perl -pi -e "s/^1A.*\n$//; s/^3A/99/" file &&
> >      GIT_AUTHOR_NAME="D" git commit -a -m "edit"'
> 
> The first line in the original is removed while the perl version
> seems to just makes it empty -- ah, you remove the trailing LF
> as well there.  I've never seen this done like this, but OK.
> 
> It would have been more obvious if it were written like this:
> 
> 	$_ = "" if ($. == 1);
> 
> but probably it is just me.

I have no strong preference.  Sometimes I find all those magic perl
variables like $. $| $, $" and so on hard to distinguish without
looking in the manual...

Regards,
Dennis 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make t8001-annotate and t8002-blame more portable
  2006-06-18 22:06   ` Dennis Stosberg
@ 2006-06-18 22:21     ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2006-06-18 22:21 UTC (permalink / raw)
  To: Dennis Stosberg; +Cc: git

Dennis Stosberg <dennis@stosberg.net> writes:

>> It would have been more obvious if it were written like this:
>> 
>> 	$_ = "" if ($. == 1);
>> 
>> but probably it is just me.
>
> I have no strong preference...

Nah, don't worry -- I've already applied your version to my
tree.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make t8001-annotate and t8002-blame more portable
  2006-06-18 20:58 ` Junio C Hamano
  2006-06-18 22:06   ` Dennis Stosberg
@ 2006-06-19 16:35   ` Alex Riesen
  2006-06-19 19:40     ` [PATCH] Fix t8001-annotate and t8002-blame for ActiveState Perl Dennis Stosberg
  1 sibling, 1 reply; 6+ messages in thread
From: Alex Riesen @ 2006-06-19 16:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Dennis Stosberg, git

On 6/18/06, Junio C Hamano <junkio@cox.net> wrote:
> > +    'perl -pi -e "s/^1A.*\n$//; s/^3A/99/" file &&

activestate perl again: doesn't work without giving a backup file extension,
like this: perl -pi.bak -e ...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Fix t8001-annotate and t8002-blame for ActiveState Perl
  2006-06-19 16:35   ` Alex Riesen
@ 2006-06-19 19:40     ` Dennis Stosberg
  0 siblings, 0 replies; 6+ messages in thread
From: Dennis Stosberg @ 2006-06-19 19:40 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Junio C Hamano, git

There seems to be at least one implementation of Perl which requires the
user to specify an extension for backup files.

Reported by Alex Riesen.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---

What system and what version of ActivePerl do you use?  I have just
tried ActivePerl 5.8.8 on Solaris and it does _not_ force the user
to make backups.

 t/annotate-tests.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index c04f0e1..03ed081 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -111,7 +111,7 @@ test_expect_success \
 
 test_expect_success \
     'some edit' \
-    'perl -pi -e "s/^1A.*\n$//; s/^3A/99/" file &&
+    'perl -p -i.orig -e "s/^1A.*\n$//; s/^3A/99/" file &&
     GIT_AUTHOR_NAME="D" git commit -a -m "edit"'
 
 test_expect_success \
-- 
1.4.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-06-19 19:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-18 20:33 [PATCH] Make t8001-annotate and t8002-blame more portable Dennis Stosberg
2006-06-18 20:58 ` Junio C Hamano
2006-06-18 22:06   ` Dennis Stosberg
2006-06-18 22:21     ` Junio C Hamano
2006-06-19 16:35   ` Alex Riesen
2006-06-19 19:40     ` [PATCH] Fix t8001-annotate and t8002-blame for ActiveState Perl Dennis Stosberg

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).