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

Re: [PATCH] submodule: fix relative url parsing for scp-style origin

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 10, 2011, 16:48 UTC
Message-ID
<20110110164801.GA7714@burratino>
In-Reply-To
<7a578ef3384a891cebd4a39421302983499771e0.1294655635.git.trast@student.ethz.ch>
Thomas Rast wrote:
> The function resolve_relative_url was not prepared to deal with an
> scp-style origin 'user@host:path' in the case where 'path' is only a
> single component.  Fix this by extending the logic that strips one
> path component from the $remoteurl.

The above description does not mention that the relative URL in question is "../otherpath". Anyway, I think it's a great idea; thanks for doing it!

> --- a/git-submodule.sh
> +++ b/git-submodule.sh
[...]
> @@ -37,12 +37,24 @@ resolve_relative_url ()
[...]
Show 9 quoted lines
> -			remoteurl="${remoteurl%/*}"
> +			case "$remoteurl" in
> +			*/*)
> +				remoteurl="${remoteurl%/*}"
> +				;;
> +			*:*)
> +				remoteurl="${remoteurl%:*}"
> +				sep=:
> +				;;
What happens to
	url = ssh://example.com:1234
	url = ftp://ftp.example.com
	url = /local/path/with/a/colon:in:it
	url = git://example.com/path/with/a/colon:in:it
> +			*)
> +				die "cannot strip one component off url '$remoteurl'"
> +				;;
	url = simple.subdir.of.cwd

? (Not a rhetorical question; I'm only curious. If the ftp example is valid then the existing code already would not cope well with it.)

> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
Nice.
Previous: Thomas RastNext: Thomas Rast
Message 2 of 7 in “submodule: fix relative url parsing for scp-style origin”
  1. submodule: fix relative url parsing for scp-style originThomas Rast, Jan 10, 2011
  2. Jonathan NiederJan 10, 2011
  3. Thomas RastJan 10, 2011
  4. Jonathan NiederJan 10, 2011
  5. Thomas RastJan 10, 2011
  6. Junio C HamanoJan 10, 2011
  7. Mark LevedahlJan 11, 2011

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.