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

Re: [PATCH v3] submodule: correct remote name with fetch

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 9, 2024, 17:51 UTC
Message-ID
<xmqqv7y1tb9v.fsf@gitster.g>
In-Reply-To
<20241009033257.1316690-1-daniel@mariadb.org>
Daniel Black <daniel@mariadb.org> writes:
Show 13 quoted lines
> The code fetches the submodules remote based on the superproject remote name
> instead of the submodule remote name[1].
>
> Instead of grabbing the default remote of the superproject repository, ask
> the default remote of the submodule we are going to run 'git fetch' in.
>
> 1. https://lore.kernel.org/git/ZJR5SPDj4Wt_gmRO@pweza/
>
> Signed-off-by: Daniel Black <daniel@mariadb.org>
> ---
>  builtin/submodule--helper.c |  9 ++++++++-
>  t/t5572-pull-submodule.sh   | 20 ++++++++++++++++++++
>  2 files changed, 28 insertions(+), 1 deletion(-)
Excellent.  Will queue.
Thanks.
Show 36 quoted lines
> diff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh
> index 916e58c166..9b6cf8d88b 100755
> --- a/t/t5572-pull-submodule.sh
> +++ b/t/t5572-pull-submodule.sh
> @@ -230,6 +230,7 @@ test_expect_success 'branch has no merge base with remote-tracking counterpart'
>  
>  	test_create_repo a-submodule &&
>  	test_commit -C a-submodule foo &&
> +	test_commit -C a-submodule bar &&
>  
>  	test_create_repo parent &&
>  	git -C parent submodule add "$(pwd)/a-submodule" &&
> @@ -246,4 +247,23 @@ test_expect_success 'branch has no merge base with remote-tracking counterpart'
>  	git -C child pull --recurse-submodules --rebase
>  '
>  
> +test_expect_success 'fetch submodule remote of different name from superproject' '
> +	git -C child remote rename origin o1 &&
> +	git -C child submodule update --init &&
> +
> +	# Needs to create unreachable commit from current master branch.
> +	git -C a-submodule checkout -b newmain HEAD^ &&
> +	test_commit -C a-submodule echo &&
> +	test_commit -C a-submodule moreecho &&
> +	subc=$(git -C a-submodule rev-parse --short HEAD) &&
> +
> +	git -C parent/a-submodule fetch &&
> +	git -C parent/a-submodule checkout "$subc" &&
> +	git -C parent commit -m "update submodule" a-submodule &&
> +	git -C a-submodule reset --hard HEAD^^ &&
> +
> +	git -C child pull --no-recurse-submodules &&
> +	git -C child submodule update
> +'
> +
>  test_done
Previous: Daniel Black
Message 12 of 12 in “bug: submodule update fails to fetch”
  1. Sergei GolubchikJun 22, 2023
  2. Taylor BlauJun 22, 2023
  3. Sergei GolubchikJun 22, 2023
  4. Jacob KellerJun 23, 2023
  5. submodule: correct remote name with fetchDaniel Black, Oct 1, 2024
  6. Junio C HamanoOct 1, 2024
  7. Junio C HamanoOct 1, 2024
  8. Daniel Black, Oct 8, 2024
  9. submodule: correct remote name with fetchDaniel Black, Oct 8, 2024
  10. Junio C HamanoOct 8, 2024
  11. submodule: correct remote name with fetchDaniel Black, Oct 9, 2024
  12. Junio C HamanoOct 9, 2024

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.