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

Re: [PATCH 1/2] submodule: port resolve_relative_url from shell to C

From
Stefan Beller <sbeller@google.com>
Date
Apr 14, 2016, 19:37 UTC
Message-ID
<CAGZ79kYZaurmnPPTUqSOYgr3V0Pnj1S+AycF9-fi_4n9+egR-Q@mail.gmail.com>
In-Reply-To
<570FF105.3040204@kdbg.org>
On Thu, Apr 14, 2016 at 12:35 PM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 48 quoted lines
> Am 14.04.2016 um 20:18 schrieb Stefan Beller:
>> @@ -298,4 +305,40 @@ test_git_path GIT_COMMON_DIR=bar config                   bar/config
>>   test_git_path GIT_COMMON_DIR=bar packed-refs              bar/packed-refs
>>   test_git_path GIT_COMMON_DIR=bar shallow                  bar/shallow
>>
>> +test_submodule_relative_url "../" "../foo" "../submodule" "../../submodule"
>> +test_submodule_relative_url "../" "../foo/bar" "../submodule" "../../foo/submodule"
>> +test_submodule_relative_url "../" "../foo/submodule" "../submodule" "../../foo/submodule"
>> +test_submodule_relative_url "../" "./foo" "../submodule" "../submodule"
>> +test_submodule_relative_url "../" "./foo/bar" "../submodule" "../foo/submodule"
>> +test_submodule_relative_url "../../../" "../foo/bar" "../sub/a/b/c" "../../../../foo/sub/a/b/c"
>> +test_submodule_relative_url "../" "$PWD/addtest" "../repo" "$PWD/repo"
>> +test_submodule_relative_url "../" "foo/bar" "../submodule" "../foo/submodule"
>> +test_submodule_relative_url "../" "foo" "../submodule" "../submodule"
>> +
>> +test_submodule_relative_url "(null)" "../foo/bar" "../sub/a/b/c" "../foo/sub/a/b/c"
>> +test_submodule_relative_url "(null)" "../foo/bar" "../submodule" "../foo/submodule"
>> +test_submodule_relative_url "(null)" "../foo/submodule" "../submodule" "../foo/submodule"
>> +test_submodule_relative_url "(null)" "../foo" "../submodule" "../submodule"
>> +test_submodule_relative_url "(null)" "./foo/bar" "../submodule" "foo/submodule"
>> +test_submodule_relative_url "(null)" "./foo" "../submodule" "submodule"
>> +test_submodule_relative_url "(null)" "//somewhere else/repo" "../subrepo" "//somewhere else/subrepo"
>> +test_submodule_relative_url "(null)" "$PWD/subsuper_update_r" "../subsubsuper_update_r" "$PWD/subsubsuper_update_r"
>> +test_submodule_relative_url "(null)" "$PWD/super_update_r2" "../subsuper_update_r" "$PWD/subsuper_update_r"
>> +test_submodule_relative_url "(null)" "$PWD/." "../." "$PWD/."
>> +test_submodule_relative_url "(null)" "$PWD" "./." "$PWD/."
>> +test_submodule_relative_url "(null)" "$PWD/addtest" "../repo" "$PWD/repo"
>> +test_submodule_relative_url "(null)" "$PWD" "./å äö" "$PWD/å äö"
>> +test_submodule_relative_url "(null)" "$PWD/." "../submodule" "$PWD/submodule"
>> +test_submodule_relative_url "(null)" "$PWD/submodule" "../submodule" "$PWD/submodule"
>> +test_submodule_relative_url "(null)" "$PWD/home2/../remote" "../bundle1" "$PWD/home2/../bundle1"
>> +test_submodule_relative_url "(null)" "$PWD/submodule_update_repo" "./." "$PWD/submodule_update_repo/."
>> +test_submodule_relative_url "(null)" "file:///tmp/repo" "../subrepo" "file:///tmp/subrepo"
>> +test_submodule_relative_url "(null)" "foo/bar" "../submodule" "foo/submodule"
>> +test_submodule_relative_url "(null)" "foo" "../submodule" "submodule"
>> +test_submodule_relative_url "(null)" "helper:://hostname/repo" "../subrepo" "helper:://hostname/subrepo"
>> +test_submodule_relative_url "(null)" "ssh://hostname/repo" "../subrepo" "ssh://hostname/subrepo"
>> +test_submodule_relative_url "(null)" "ssh://hostname:22/repo" "../subrepo" "ssh://hostname:22/subrepo"
>> +test_submodule_relative_url "(null)" "user@host:path/to/repo" "../subrepo" "user@host:path/to/subrepo"
>> +test_submodule_relative_url "(null)" "user@host:repo" "../subrepo" "user@host:subrepo"
>> +
>>   test_done
>>
>
> I am very sorry that I am chiming in again so late. I forgot to mention
> that this requires a fixup on Windows as below. I won't mind to submit
> the fixup as a follow-on patch, but you could also squash it in if yet
> another round is required.

Thanks a lot for testing a patch on Windows! I'll pick this up in a resend.

Show 53 quoted lines
>
> diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
> index 579c1fa..1d19fbb 100755
> --- a/t/t0060-path-utils.sh
> +++ b/t/t0060-path-utils.sh
> @@ -293,13 +293,16 @@ test_git_path GIT_COMMON_DIR=bar config                   bar/config
>  test_git_path GIT_COMMON_DIR=bar packed-refs              bar/packed-refs
>  test_git_path GIT_COMMON_DIR=bar shallow                  bar/shallow
>
> +# In the tests below, the distinction between $PWD and $(pwd) is important:
> +# on Windows, $PWD is POSIX style (/c/foo), $(pwd) has drive letter (c:/foo).
> +
>  test_submodule_relative_url "../" "../foo" "../submodule" "../../submodule"
>  test_submodule_relative_url "../" "../foo/bar" "../submodule" "../../foo/submodule"
>  test_submodule_relative_url "../" "../foo/submodule" "../submodule" "../../foo/submodule"
>  test_submodule_relative_url "../" "./foo" "../submodule" "../submodule"
>  test_submodule_relative_url "../" "./foo/bar" "../submodule" "../foo/submodule"
>  test_submodule_relative_url "../../../" "../foo/bar" "../sub/a/b/c" "../../../../foo/sub/a/b/c"
> -test_submodule_relative_url "../" "$PWD/addtest" "../repo" "$PWD/repo"
> +test_submodule_relative_url "../" "$PWD/addtest" "../repo" "$(pwd)/repo"
>  test_submodule_relative_url "../" "foo/bar" "../submodule" "../foo/submodule"
>  test_submodule_relative_url "../" "foo" "../submodule" "../submodule"
>
> @@ -310,16 +313,16 @@ test_submodule_relative_url "(null)" "../foo" "../submodule" "../submodule"
>  test_submodule_relative_url "(null)" "./foo/bar" "../submodule" "foo/submodule"
>  test_submodule_relative_url "(null)" "./foo" "../submodule" "submodule"
>  test_submodule_relative_url "(null)" "//somewhere else/repo" "../subrepo" "//somewhere else/subrepo"
> -test_submodule_relative_url "(null)" "$PWD/subsuper_update_r" "../subsubsuper_update_r" "$PWD/subsubsuper_update_r"
> -test_submodule_relative_url "(null)" "$PWD/super_update_r2" "../subsuper_update_r" "$PWD/subsuper_update_r"
> -test_submodule_relative_url "(null)" "$PWD/." "../." "$PWD/."
> -test_submodule_relative_url "(null)" "$PWD" "./." "$PWD/."
> -test_submodule_relative_url "(null)" "$PWD/addtest" "../repo" "$PWD/repo"
> -test_submodule_relative_url "(null)" "$PWD" "./å äö" "$PWD/å äö"
> -test_submodule_relative_url "(null)" "$PWD/." "../submodule" "$PWD/submodule"
> -test_submodule_relative_url "(null)" "$PWD/submodule" "../submodule" "$PWD/submodule"
> -test_submodule_relative_url "(null)" "$PWD/home2/../remote" "../bundle1" "$PWD/home2/../bundle1"
> -test_submodule_relative_url "(null)" "$PWD/submodule_update_repo" "./." "$PWD/submodule_update_repo/."
> +test_submodule_relative_url "(null)" "$PWD/subsuper_update_r" "../subsubsuper_update_r" "$(pwd)/subsubsuper_update_r"
> +test_submodule_relative_url "(null)" "$PWD/super_update_r2" "../subsuper_update_r" "$(pwd)/subsuper_update_r"
> +test_submodule_relative_url "(null)" "$PWD/." "../." "$(pwd)/."
> +test_submodule_relative_url "(null)" "$PWD" "./." "$(pwd)/."
> +test_submodule_relative_url "(null)" "$PWD/addtest" "../repo" "$(pwd)/repo"
> +test_submodule_relative_url "(null)" "$PWD" "./å äö" "$(pwd)/å äö"
> +test_submodule_relative_url "(null)" "$PWD/." "../submodule" "$(pwd)/submodule"
> +test_submodule_relative_url "(null)" "$PWD/submodule" "../submodule" "$(pwd)/submodule"
> +test_submodule_relative_url "(null)" "$PWD/home2/../remote" "../bundle1" "$(pwd)/home2/../bundle1"
> +test_submodule_relative_url "(null)" "$PWD/submodule_update_repo" "./." "$(pwd)/submodule_update_repo/."
>  test_submodule_relative_url "(null)" "file:///tmp/repo" "../subrepo" "file:///tmp/subrepo"
>  test_submodule_relative_url "(null)" "foo/bar" "../submodule" "foo/submodule"
>  test_submodule_relative_url "(null)" "foo" "../submodule" "submodule"
> --
> 2.7.0.118.g90056ae
>
Previous: Johannes SixtNext: Stefan Beller
Message 4 of 6 in “Port `submodule init` to C”
  1. 0/2 Port `submodule init` to CStefan Beller, Apr 14, 2016
  2. 1/2 submodule: port resolve_relative_url from shell to CStefan Beller, Apr 14, 2016
  3. Johannes SixtApr 14, 2016
  4. Stefan BellerApr 14, 2016
  5. 2/2 submodule: port init from shell to CStefan Beller, Apr 14, 2016
  6. Junio C HamanoApr 14, 2016

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.