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

Re: [PATCH 2/3] submodule tests: replace cloning from . by "$(pwd)"

From
Johannes Sixt <j6t@kdbg.org>
Date
Oct 23, 2016, 10:14 UTC
Message-ID
<61637cd9-8f83-c988-15c0-54f948153c07@kdbg.org>
In-Reply-To
<CAGZ79kaukGh2ynkOQcF=skzxTMYr8CFRyGJw6FEmNsTAcaG_VQ@mail.gmail.com>
Am 22.10.2016 um 22:46 schrieb Stefan Beller:
Show 9 quoted lines
> I have looked into it again, and by now I think the bug is a feature,
> actually.
>
> Consider this:
>
>     git clone . super
>     git -C super submodule add ../submodule
>     # we thought the previous line is buggy
>     git clone super super-clone

At this point, we *should* have this if there were no bugs (at least that is my assumption):

   /tmp
   !
   + submodule     <- submodule's remote repo
   !
   + foo           <- we are here (.), super's remote repo
     !
     + super       <- remote.origin.url=/tmp/foo/.
       !
       + submodule <- remote.origin.url=/tmp/foo/./../submodule
                      submodule.submodule.url=../submodule
When I test this, 'git submodule add' fails:

foo@master> git -C super submodule add ../submodule fatal: repository '/tmp/foo/submodule' does not exist fatal: clone of '/tmp/foo/submodule' into submodule path '/tmp/foo/super/submodule' failed

> Now in the super-clone the ../submodule is the correct
> relative url, because the url where we cloned from doesn't
> end in /.

I do not understand why this would be relevant. The question is not how the submodule's remote URL ends, but how the submodule's remote URL is constructed from the super-project's URL and the relative path specified for 'git submodule add'.

Whether ../submodule or ./submodule is the correct relative URL depends on where the origin of the submodule is located relative to the origin of the super-project. In the above example, it is ../submodule. However, the error message tells us that git looked in /tmp/foo/submodule, which looks like the /. bug!

I do not understand where you see a feature here. What am I missing?
-- Hannes
Previous: Stefan BellerNext: Junio C Hamano
Message 8 of 11 in “Fix submodule url issues”
  1. 0/3 Fix submodule url issuesStefan Beller, Oct 21, 2016
  2. 1/3 t7506: fix diff order arguments in test_cmpStefan Beller, Oct 21, 2016
  3. 3/3 submodule--helper: normalize funny urlsStefan Beller, Oct 21, 2016
  4. 2/3 submodule tests: replace cloning from . by "$(pwd)"Stefan Beller, Oct 21, 2016
  5. Johannes SixtOct 22, 2016
  6. Junio C HamanoOct 22, 2016
  7. Stefan BellerOct 22, 2016
  8. Johannes SixtOct 23, 2016
  9. Junio C HamanoOct 24, 2016
  10. Stefan BellerOct 24, 2016
  11. Johannes SixtOct 24, 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.