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

Re: [PATCH] git-submodule.sh - Remove trailing / from URL if found

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 21, 2008, 18:00 UTC
Message-ID
<7vej4ii6y8.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<30e4a070808210504l1dd6b491l1d66dcd96a238ebc@mail.gmail.com>
"Mark Levedahl" <mlevedahl@gmail.com> writes:
Show 44 quoted lines
> The problem I'm trying to fix is that a number of folks have
> superprojects checked out where the recorded origin URL has a trailing
> /, and a submodule has its origin in a directory sitting right next to
> the superproject on the server. Thus, we have:
>
>    superproject url = server:/public/super
>    submodoule url = server:/public/sub1
>
> However, in the checked out superproject's .git/config
> [remote "origin"]
>    url = server:/public/super/
>
> and for similar reasons, the submodule has its URL recorded in .gitmodules as
> [submodule "sub"]
>    path = submodule1
>    url = ../sub1/
>
> resolve_relative_url gets the submodule's recorded url as $1, which
> the caller retrieved from .gitmodules, and retrieves the superprojects
> origin from .git/config. So in this case resolve_relative_url has
> that:
>    url = ../sub1/
>    remoteurl = server:/public/super/
>
> So, without any patch, resolve_relative_url computes the submodule's URL as:
>    server:/public/super/sub1/
>
> with the first patch as:
>    server:/public/super/sub1
>
> and with the second as
>    server:/public/sub1
> rather than
>    server:/public/sub1
>
> So, the second patch I sent is the one that fixes the above problem,
> and I have to say I now forget what the confused state of .gitmodules
> + .git/config I found on one machine that lead to the first patch as
> being a correct fix.
>
> In summary, it is essential that resolve_relative_url strip the
> trailing / from the superproject's url before starting, while it is
> nice but not necessary if it assures that the result does not contain
> a trailing /.

Well, that is a description worth having in the proposed commit log message, isn't it?

Previous: Mark LevedahlNext: Mark Levedahl
Message 6 of 7 in “git-submodule.sh - Remove trailing / from URL if found”
  1. git-submodule.sh - Remove trailing / from URL if foundMark Levedahl, Aug 20, 2008
  2. Junio C HamanoAug 20, 2008
  3. git-submodule.sh - Remove trailing / from URL if foundMark Levedahl, Aug 21, 2008
  4. Junio C HamanoAug 21, 2008
  5. Mark LevedahlAug 21, 2008
  6. Junio C HamanoAug 21, 2008
  7. git-submodule.sh - Remove trailing / from URL if foundMark Levedahl, Aug 21, 2008

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.