Subject: Re: [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work

From: Junio C Hamano <[email-masked]>
Date: Sun, 24 Jan 2016 18:14:27 -0800

Johannes Schindelin <[email-masked]> writes:

> From: 마누엘 <[email-masked]>
>
> Some git-svn tests expect that the executable bit of files can be
> toggled. On Windows, this is not possible because Windows' Access
> Control Lists are much more fine-grained than the POSIX permission
> concept. Let's just not try to flip the executable bit.

Most of the changes are protected by !POSIXPERM but one of them
seems to use MINGW, which looks inconsistent and I suspect was not a
distinction made on purpose.  The above description sounds to me
that the !POSIXPERM prerequisite is the right thing to use.

I am not sure if it is a good idea to sprinkle test-have-prereq and
make the test script test different things on different platforms,
though.

> This lets t9118-git-svn-funky-branch-names.sh and
> t9124-git-svn-dcommit-auto-props.sh pass in Git for Windows' SDK,
> and partially fixes t9100-git-svn-basic.sh.
>
> Signed-off-by: 마누엘 <[email-masked]>
> Signed-off-by: Johannes Schindelin <[email-masked]>
> ---
>  t/t9100-git-svn-basic.sh              |  5 ++++-
>  t/t9118-git-svn-funky-branch-names.sh | 12 +++++++++---
>  t/t9124-git-svn-dcommit-auto-props.sh | 20 ++++++++++++++++----
>  3 files changed, 29 insertions(+), 8 deletions(-)
>
> diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
> index dbb440b..bca7ec8 100755
> --- a/t/t9100-git-svn-basic.sh
> +++ b/t/t9100-git-svn-basic.sh
> @@ -38,7 +38,10 @@ test_expect_success \
>  		mkdir bar &&
>  		echo "zzz" >bar/zzz &&
>  		echo "#!/bin/sh" >exec.sh &&
> -		chmod +x exec.sh &&
> +		{
> +			test_have_prereq !POSIXPERM ||
> +			chmod +x exec.sh
> +		} &&
>  		svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
>  	) &&
>  	rm -rf import &&
> diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
> index a221915..49775a5 100755
> --- a/t/t9118-git-svn-funky-branch-names.sh
> +++ b/t/t9118-git-svn-funky-branch-names.sh
> @@ -23,8 +23,11 @@ test_expect_success 'setup svnrepo' '
>  	              "$svnrepo/pr ject/branches/$scary_uri" &&
>  	svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
>  			"$svnrepo/pr ject/branches/.leading_dot" &&
> -	svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
> -			"$svnrepo/pr ject/branches/trailing_dot." &&
> +	{
> +		test_have_prereq MINGW ||
> +		svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
> +			"$svnrepo/pr ject/branches/trailing_dot."
> +	} &&
>  	svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
>  			"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
>  	svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
> @@ -45,7 +48,10 @@ test_expect_success 'test clone with funky branch names' '
>  		git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
>  		git rev-parse "refs/remotes/origin/$scary_ref" &&
>  		git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
> -		git rev-parse "refs/remotes/origin/trailing_dot%2E" &&
> +		{
> +			test_have_prereq MINGW ||
> +			git rev-parse "refs/remotes/origin/trailing_dot%2E"
> +		} &&
>  		git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
>  		git rev-parse "refs/remotes/origin/$non_reflog"
>  	)
> diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
> index aa841e1..c851121 100755
> --- a/t/t9124-git-svn-dcommit-auto-props.sh
> +++ b/t/t9124-git-svn-dcommit-auto-props.sh
> @@ -35,7 +35,10 @@ test_expect_success 'enable auto-props config' '
>  
>  test_expect_success 'add files matcihng auto-props' '
>  	echo "#!$SHELL_PATH" >exec1.sh &&
> -	chmod +x exec1.sh &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		chmod +x exec1.sh
> +	} &&
>  	echo "hello" >hello.txt &&
>  	echo bar >bar &&
>  	git add exec1.sh hello.txt bar &&
> @@ -49,7 +52,10 @@ test_expect_success 'disable auto-props config' '
>  
>  test_expect_success 'add files matching disabled auto-props' '
>  	echo "#$SHELL_PATH" >exec2.sh &&
> -	chmod +x exec2.sh &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		chmod +x exec2.sh
> +	} &&
>  	echo "world" >world.txt &&
>  	echo zot >zot &&
>  	git add exec2.sh world.txt zot &&
> @@ -65,7 +71,10 @@ test_expect_success 'check resulting svn repository' '
>  	cd svnrepo &&
>  
>  	# Check properties from first commit.
> -	test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
> +	} &&
>  	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
>  	     "xapplication/x-shellscript" &&
>  	test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
> @@ -73,7 +82,10 @@ test_expect_success 'check resulting svn repository' '
>  	test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
>  
>  	# Check properties from second commit.
> -	test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
> +	} &&
>  	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
>  	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
>  	test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&