Subject: Re: [PATCH] t2080: fix cp invocation to copy symlinks instead of following them

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 27 May 2021 14:51:07 +0200

On Wed, May 26 2021, Matheus Tavares wrote:

> t2080 makes a few copies of a test repository and later performs a
> branch switch on each one of the copies to verify that parallel checkout
> and sequential checkout produce the same results. However, the
> repository is copied with `cp -R` which, on some systems, defaults to
> following symlinks on the directory hierarchy and copying their target
> files instead of copying the symlinks themselves. AIX is one example of
> system where this happens. Because the symlinks are not preserved, the
> copied repositories have paths that do not match what is in the index,
> causing git to abort the checkout operation that we want to test. This
> makes the test fail on these systems.
>
> Fix this by copying the repository with the POSIX flag '-P', which
> forces cp to copy the symlinks instead of following them. Note that we
> already use this flag for other cp invocations in our test suite (see
> t7001). With this change, t2080 now passes on AIX.
>
> Reported-by: Ævar Arnfjörð Bjarmason <[email-masked]>
> Signed-off-by: Matheus Tavares <[email-masked]>
> ---
>  t/t2080-parallel-checkout-basics.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t2080-parallel-checkout-basics.sh b/t/t2080-parallel-checkout-basics.sh
> index 7087818550..3e0f8c675f 100755
> --- a/t/t2080-parallel-checkout-basics.sh
> +++ b/t/t2080-parallel-checkout-basics.sh
> @@ -114,7 +114,7 @@ do
>  
>  	test_expect_success "$mode checkout" '
>  		repo=various_$mode &&
> -		cp -R various $repo &&
> +		cp -R -P various $repo &&
>  
>  		# The just copied files have more recent timestamps than their
>  		# associated index entries. So refresh the cached timestamps

Thanks for the quick fix, I can confirm that this makes the test pass on
AIX 7.2.