Subject: Re: [PATCH 07/10] t1006: accommodate for symlink support in MSYS2

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 1 Dec 2025 10:47:15 +0100

On Sat, Nov 29, 2025 at 06:28:23PM +0000, Johannes Schindelin via GitGitGadget wrote:
> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
> index 1f61b666a7..0eee3bb878 100755
> --- a/t/t1006-cat-file.sh
> +++ b/t/t1006-cat-file.sh
> @@ -1048,18 +1048,28 @@ test_expect_success 'git cat-file --batch-check --follow-symlinks works for out-
>  	echo .. >>expect &&
>  	echo HEAD:dir/subdir/out-of-repo-link-dir | git cat-file --batch-check --follow-symlinks >actual &&
>  	test_cmp expect actual &&
> -	echo symlink 3 >expect &&
> -	echo ../ >>expect &&
> +	if test_have_prereq MINGW,SYMLINKS
> +	then
> +		test_write_lines "symlink 2" ..
> +	else
> +		test_write_lines "symlink 3" ../
> +	fi >expect &&
>  	echo HEAD:dir/subdir/out-of-repo-link-dir-trailing | git cat-file --batch-check --follow-symlinks >actual &&
>  	test_cmp expect actual
>  '

Okay.

>  test_expect_success 'git cat-file --batch-check --follow-symlinks works for symlinks with internal ..' '
> -	echo HEAD: | git cat-file --batch-check >expect &&
> -	echo HEAD:up-down | git cat-file --batch-check --follow-symlinks >actual &&
> -	test_cmp expect actual &&
> -	echo HEAD:up-down-trailing | git cat-file --batch-check --follow-symlinks >actual &&
> -	test_cmp expect actual &&
> +	if test_have_prereq !MINGW
> +	then
> +		# The `up-down` and `up-down-trailing` symlinks are normalized
> +		# in MSYS in `winsymlinks` mode and are therefore in a
> +		# different shape than Git expects them.
> +		echo HEAD: | git cat-file --batch-check >expect &&
> +		echo HEAD:up-down | git cat-file --batch-check --follow-symlinks >actual &&
> +		test_cmp expect actual &&
> +		echo HEAD:up-down-trailing | git cat-file --batch-check --follow-symlinks >actual &&
> +		test_cmp expect actual
> +	fi &&
>  	echo HEAD:up-down-file | git cat-file --batch-check --follow-symlinks >actual &&
>  	test_cmp found actual &&
>  	echo symlink 7 >expect &&

I'm not quite sure I follow, so my questions may be dumb. Does this mean
that git-cat-file(1) fails to follow the symlink in this case, and
consequently we cannot execute it at all? If so, is this a bug that
we'll eventually have to fix?

If this is something we can fix it could be sensible to have an `else`
branch that documents the failure case. In that case, we would then
notice that the test fails once we fix the underlying issue.

Patrick