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

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?

From
PWPete Wyckoff <pw@padd.com>
Date
Jul 23, 2014, 23:07 UTC
Message-ID
<20140723230754.GB10722@padd.com>
In-Reply-To
<CABUJjW8TFCw2wwAO83vMBPc7vQc+rvuPOAca-CNECEduUn19Ew@mail.gmail.com>
ml.christophbonitz@gmail.com wrote on Wed, 23 Jul 2014 23:28 +0200:
Show 7 quoted lines
> The scenario in the rename test makes unnecessary assumptions about
> which file git file-tree will detect as a source for a copy-operations.
> Furthermore, copy detection is not tested by checking the resulting
> perforce revision history via p4 filelog, but via git diff-tree.
> 
> This patch makes the test more robust by accepting each of the possible
> sources, and more rigorous by doing so via p4 filelog.

I see what you're doing here, and it all looks good. The diff-tree checks were mainly debugging, and if "p4 filelog" shows the right "branch from", that means it works.

You might be able to firm up the "branch from" lines for file8 and file9 too, but those aren't likely to fail.

Indeed, as noted in the other thread, it would be better to make these not so flaky, but your change here fixes a problem, and doesn't do any harm. And gives you an opportunity to fix it more later. :)

Be sure to fix the word-wrapping you have on two of the lines below. And be careful not to top post.

Here's my ack for when you decide to send it back to the list, cc junio.

Acked-by: Pete Wyckoff <pw@padd.com>
Show 56 quoted lines
> ---
>  t/t9814-git-p4-rename.sh | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
> index 1fc1f5f..4068510 100755
> --- a/t/t9814-git-p4-rename.sh
> +++ b/t/t9814-git-p4-rename.sh
> @@ -156,18 +156,16 @@ test_expect_success 'detect copies' '
>   git diff-tree -r -C HEAD &&
>   git p4 submit &&
>   p4 filelog //depot/file10 &&
> - p4 filelog //depot/file10 | grep -q "branch from //depot/file" &&
> + p4 filelog //depot/file10 | grep -q "branch from //depot/file2" &&
> 
>   cp file2 file11 &&
>   git add file11 &&
>   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 &&
>   git config git-p4.detectCopiesHarder true &&
>   git p4 submit &&
>   p4 filelog //depot/file11 &&
> - p4 filelog //depot/file11 | grep -q "branch from //depot/file" &&
> + p4 filelog //depot/file11 | grep -q -E "branch from //depot/file(2|10)" &&
> 
>   cp file2 file12 &&
>   echo "some text" >>file12 &&
> @@ -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 &&
>   git config git-p4.detectCopies $(($level + 2)) &&
>   git p4 submit &&
>   p4 filelog //depot/file12 &&
> @@ -190,12 +188,10 @@ test_expect_success 'detect copies' '
>   git diff-tree -r -C --find-copies-harder HEAD &&
>   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 &&
>   git config git-p4.detectCopies $(($level - 2)) &&
>   git p4 submit &&
>   p4 filelog //depot/file13 &&
> - p4 filelog //depot/file13 | grep -q "branch from //depot/file"
> + p4 filelog //depot/file13 | grep -q -E "branch from //depot/file(2|10|11|12)"
>   )
>  '
> 
> -- 
> 2.0.1
Previous: Christoph BonitzNext: Johannes Sixt
Message 2 of 7 in “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?”
  1. 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, Jul 23, 2014
  2. Pete WyckoffJul 23, 2014
  3. Johannes SixtJul 24, 2014
  4. Junio C HamanoJul 24, 2014
  5. Christoph BonitzJul 30, 2014
  6. Junio C HamanoJul 30, 2014
  7. Christoph BonitzJul 30, 2014

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.