All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Christoph Bonitz <ml.christophbonitz@gmail.com>,
	Pete Wyckoff <pw@padd.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] git p4 test: fix failure in 9814-git-p4-rename.sh Was: Re: Test failure in t9814-git-p4-rename.sh - my environment or bad test?
Date: Thu, 24 Jul 2014 15:05:54 -0700	[thread overview]
Message-ID: <xmqq4my68la5.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <53D1543F.50508@kdbg.org> (Johannes Sixt's message of "Thu, 24 Jul 2014 20:45:19 +0200")

Johannes Sixt <j6t@kdbg.org> writes:

>> @@ -177,7 +175,7 @@ test_expect_success 'detect copies' '
>>   level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
>>   test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
>>   src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
>> - test "$src" = file10 || test "$src" = file11 &&
>> + test "$src" = file2 || test "$src" = file10 || test "$src" = file11 &&
>
> You can't test for alternatives in this way. It's already wrong in the
> original line, which is from 795fcb0e (avoid "test <cond> -a/-o <cond>"),
> and breaks the && chain. You need braces like this:
>
>   { test "$src" = file2 || test "$src" = file10 || test "$src" = file11; } &&
>
> or you wrap it up in a case statement.
> ...
>>   )
>>  '
>> 
>
> I see a few other no-nos in the context of the changes, in particular,
> pipelines where git is not the last command; these would not catch
> failures in the git commands. But a fix for that is certainly outside
> the scope of this patch.

Yuck.  Thanks for spotting.

Perhaps we should apply a preliminary clean-up before doing anything
else, perhaps?  The change in 9814 is a post 2.0 regression.



 t/t9814-git-p4-rename.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index 1fc1f5f..95f4421 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -177,7 +177,10 @@ test_expect_success 'detect copies' '
 		level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
 		test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
 		src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
-		test "$src" = file10 || test "$src" = file11 &&
+		case "$src" in
+		file10 | file11) : ;; # happy
+		*) false ;; # not
+		&&
 		git config git-p4.detectCopies $(($level + 2)) &&
 		git p4 submit &&
 		p4 filelog //depot/file12 &&
@@ -191,7 +194,10 @@ test_expect_success 'detect copies' '
 		level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
 		test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
 		src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
-		test "$src" = file10 || test "$src" = file11 || test "$src" = file12 &&
+		case "$src" in
+		file10 | file11 | file12) : ;; # happy
+		*) false ;; # not
+		&&
 		git config git-p4.detectCopies $(($level - 2)) &&
 		git p4 submit &&
 		p4 filelog //depot/file13 &&

  reply	other threads:[~2014-07-24 22:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 21:28 [PATCH] git p4 test: fix failure in 9814-git-p4-rename.sh Was: Re: Test failure in t9814-git-p4-rename.sh - my environment or bad test? Christoph Bonitz
2014-07-23 23:07 ` Pete Wyckoff
2014-07-24 18:45 ` Johannes Sixt
2014-07-24 22:05   ` Junio C Hamano [this message]
2014-07-30  7:08     ` Christoph Bonitz
2014-07-30 19:09       ` Junio C Hamano
2014-07-30  7:07   ` Christoph Bonitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4my68la5.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=ml.christophbonitz@gmail.com \
    --cc=pw@padd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.