git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH V2 2/2] git-p4: Fix copy detection test

From
Vitor Antunes <vitor.hda@gmail.com>
Date
Mar 28, 2015, 00:03 UTC
Message-ID
<1427500983-8802-3-git-send-email-vitor.hda@gmail.com>
In-Reply-To
<1427500983-8802-1-git-send-email-vitor.hda@gmail.com>

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
Previous: Vitor AntunesNext: Junio C Hamano
Message 3 of 4 in “git-p4: Small updates to test cases”
  1. 0/2 git-p4: Small updates to test casesVitor Antunes, Mar 28, 2015
  2. 1/2 git-p4: Make rename test case runnable under dashVitor Antunes, Mar 28, 2015
  3. 2/2 git-p4: Fix copy detection testVitor Antunes, Mar 28, 2015
  4. Junio C HamanoMar 28, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.