Re: [PATCH 11/25] t7400: fix broken "submodule add/reconfigure --force" test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eric,

On Sun, 1 Jul 2018, Eric Sunshine wrote:

> This test has been dysfunctional since it was added by 619acfc78c
> (submodule add: extend force flag to add existing repos, 2016-10-06),
> however, two problems early in the test went unnoticed due to a broken
> &&-chain later in the test.
> 
> First, it tries configuring the submodule with repository "bogus-url",
> however, "git submodule add" insists that the repository be either an
> absolute URL or a relative pathname requiring prefix "./" or "../" (this
> is true even with --force), but "bogus-url" does not meet those
> criteria, thus the command fails.
> 
> Second, it then tries configuring a submodule with a path which is
> .gitignore'd, which is disallowed. This restriction can be overridden
> with --force, but the test neglects to use that option.
> 
> Fix both problems, as well as the broken &&-chain behind which they hid.
> 
> Reviewed-by: Stefan Beller <sbeller@xxxxxxxxxx>
> Signed-off-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
> ---
>  t/t7400-submodule-basic.sh | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index 812db137b8..401adaed32 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -171,12 +171,12 @@ test_expect_success 'submodule add to .gitignored path with --force' '
>  test_expect_success 'submodule add to reconfigure existing submodule with --force' '
>  	(
>  		cd addtest-ignore &&
> -		git submodule add --force bogus-url submod &&
> -		git submodule add -b initial "$submodurl" submod-branch &&
> -		test "bogus-url" = "$(git config -f .gitmodules submodule.submod.url)" &&
> -		test "bogus-url" = "$(git config submodule.submod.url)" &&
> +		git submodule add --force /bogus-url submod &&
> +		git submodule add --force -b initial "$submodurl" submod-branch &&
> +		test "/bogus-url" = "$(git config -f .gitmodules submodule.submod.url)" &&
> +		test "/bogus-url" = "$(git config submodule.submod.url)" &&
>  		# Restore the url
> -		git submodule add --force "$submodurl" submod
> +		git submodule add --force "$submodurl" submod &&
>  		test "$submodurl" = "$(git config -f .gitmodules submodule.submod.url)" &&
>  		test "$submodurl" = "$(git config submodule.submod.url)"
>  	)

This breaks on Windows because of the absolute Unix-y path having to be
translated to a Windows path:

	https://git-for-windows.visualstudio.com/git/git%20Team/_build/results?buildId=12365&view=logs

(In this case, it is prefixed with `C:/git-sdk-64-ci` because that is the
pseudo root when running in a Git for Windows SDK that is installed into
that directory.)

I could imagine that using "$(pwd)/bogus-url" (which will generate a
Windows-y absolute path on Windows) would work, though.

Ciao,
Dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux