git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/2] git-p4: Small updates to test cases
@ 2015-03-28  0:03 Vitor Antunes
  2015-03-28  0:03 ` [PATCH V2 1/2] git-p4: Make rename test case runnable under dash Vitor Antunes
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vitor Antunes @ 2015-03-28  0:03 UTC (permalink / raw)
  To: git; +Cc: Vitor Antunes

Updated both fixes:

1. Remove "true" from case statements and replaced it with ":".
2. Also use a case statement in the copy detection test to allow
   diff-tree to detect two different files as the origin of the
   copy. I've also reverted a change I introduced in the V1 patch
   that no longer makes much sense to me.

Vitor Antunes (2):
  git-p4: Make rename test case runnable under dash
  git-p4: Fix copy detection test

 t/t9814-git-p4-rename.sh |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

-- 
1.7.10.4

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

* [PATCH V2 1/2] git-p4: Make rename test case runnable under dash
  2015-03-28  0:03 [PATCH V2 0/2] git-p4: Small updates to test cases Vitor Antunes
@ 2015-03-28  0:03 ` Vitor Antunes
  2015-03-28  0:03 ` [PATCH V2 2/2] git-p4: Fix copy detection test Vitor Antunes
  2015-03-28 16:07 ` [PATCH V2 0/2] git-p4: Small updates to test cases Junio C Hamano
  2 siblings, 0 replies; 4+ messages in thread
From: Vitor Antunes @ 2015-03-28  0:03 UTC (permalink / raw)
  To: git; +Cc: Vitor Antunes


Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
---
 t/t9814-git-p4-rename.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index 95f4421..efae143 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -180,7 +180,7 @@ test_expect_success 'detect copies' '
 		case "$src" in
 		file10 | file11) : ;; # happy
 		*) false ;; # not
-		&&
+		esac &&
 		git config git-p4.detectCopies $(($level + 2)) &&
 		git p4 submit &&
 		p4 filelog //depot/file12 &&
@@ -197,7 +197,7 @@ test_expect_success 'detect copies' '
 		case "$src" in
 		file10 | file11 | file12) : ;; # happy
 		*) false ;; # not
-		&&
+		esac &&
 		git config git-p4.detectCopies $(($level - 2)) &&
 		git p4 submit &&
 		p4 filelog //depot/file13 &&
-- 
1.7.10.4

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

* [PATCH V2 2/2] git-p4: Fix copy detection test
  2015-03-28  0:03 [PATCH V2 0/2] git-p4: Small updates to test cases Vitor Antunes
  2015-03-28  0:03 ` [PATCH V2 1/2] git-p4: Make rename test case runnable under dash Vitor Antunes
@ 2015-03-28  0:03 ` Vitor Antunes
  2015-03-28 16:07 ` [PATCH V2 0/2] git-p4: Small updates to test cases Junio C Hamano
  2 siblings, 0 replies; 4+ messages in thread
From: Vitor Antunes @ 2015-03-28  0:03 UTC (permalink / raw)
  To: git; +Cc: Vitor Antunes

File file11 is copied from file2 and diff-tree correctly reports this file as
its the source. But it is possible that the diff-tree algorithm detects file10,
which was also copied from file2, as the origin of the new file.

This fix uses a case statement to support both files as the source of file11, as
was done in other tests in this file.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
---
 t/t9814-git-p4-rename.sh |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index efae143..8b9c295 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -163,7 +163,10 @@ test_expect_success 'detect copies' '
 		git commit -a -m "Copy file2 to file11" &&
 		git diff-tree -r -C --find-copies-harder HEAD &&
 		src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
-		test "$src" = file10 &&
+		case "$src" in
+		file2 | file10) : ;; # happy
+		*) false ;; # not
+		esac &&
 		git config git-p4.detectCopiesHarder true &&
 		git p4 submit &&
 		p4 filelog //depot/file11 &&
-- 
1.7.10.4

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

* Re: [PATCH V2 0/2] git-p4: Small updates to test cases
  2015-03-28  0:03 [PATCH V2 0/2] git-p4: Small updates to test cases Vitor Antunes
  2015-03-28  0:03 ` [PATCH V2 1/2] git-p4: Make rename test case runnable under dash Vitor Antunes
  2015-03-28  0:03 ` [PATCH V2 2/2] git-p4: Fix copy detection test Vitor Antunes
@ 2015-03-28 16:07 ` Junio C Hamano
  2 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2015-03-28 16:07 UTC (permalink / raw)
  To: Vitor Antunes; +Cc: git, Pete Wyckoff

Will apply both.

It seems that I am to blame for 1/2 for botching the shell syntax
X-<.  Thanks for fixing.

I was not entirely happy with the "we could find either file10 or
file11 because they are the same, so let's declare both are success"
in the original, f69b3a93 (git p4 test: copy source indeterminate,
2012-06-27) in the first place, which survived the 9b6513ac (git p4
test: split up big t9800 test, 2012-06-27) and e832f737 (t9814: fix
misconversion from test $a -o $b to test $a || test $b, 2014-07-25).
I think a better fix would have been not to have multiple identical
copies in the tested tree to begin with.

But 2/2 is an acceptable interim fix that uses the same approach as
we have been using since f69b3a93, so it should do at least for now.

Thanks.

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

end of thread, other threads:[~2015-03-28 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-28  0:03 [PATCH V2 0/2] git-p4: Small updates to test cases Vitor Antunes
2015-03-28  0:03 ` [PATCH V2 1/2] git-p4: Make rename test case runnable under dash Vitor Antunes
2015-03-28  0:03 ` [PATCH V2 2/2] git-p4: Fix copy detection test Vitor Antunes
2015-03-28 16:07 ` [PATCH V2 0/2] git-p4: Small updates to test cases Junio C Hamano

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