{"thread":{"id":"22826","subject":"Re: [PATCH] submodule: Improve handling of relative submodule URLs.","startedAt":"2010-02-25T19:28:29Z","lastAt":"2010-02-26T02:03:50Z","messageCount":2,"participants":["Mark Levedahl","Jacob Helwig"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"299166","messageId":"1267126109-14638-1-git-send-email-jacob.helwig@gmail.com","threadId":"22826","inReplyTo":null,"subject":"[PATCH] submodule: Improve handling of relative submodule URLs.","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2010-02-25T19:28:29Z","receivedAt":"2010-02-25T19:28:29Z","isPatch":true,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"Relative URLs only worked with <proto>://<host>/<location> style URLs, and\nwould break when cloning a repository using <user>@<host>:<location> (scp)\nstyle \"URL\"s.\n\nWhen a submodule's URL was set to \"../submodule.git\", and the repository\nusing it was cloned from \"git@example.com:repo.git\", git would try to\nclone the submodule from \"git@example.com:repo.git/submodule.git\", which\nwould not likely work.\n\nThis updates resolve_relative_url to handle the scp style URLs.\n\nSigned-off-by: Jacob Helwig <jacob.helwig@gmail.com>\n---\n git-submodule.sh |    9 +++++----\n 1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 664f217..97787a3 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -37,18 +37,19 @@ resolve_relative_url ()\n \twhile test -n \"$url\"\n \tdo\n \t\tcase \"$url\" in\n-\t\t../*)\n+\t\t..[/:]*)\n \t\t\turl=\"${url#../}\"\n-\t\t\tremoteurl=\"${remoteurl%/*}\"\n+\t\t\tremoteurl=\"$(echo \"$remoteurl\" | sed -e 's|\\(.*[/:]\\).*|\\1|')\"\n \t\t\t;;\n-\t\t./*)\n+\t\t.[/:]*)\n \t\t\turl=\"${url#./}\"\n+\t\t\tremoteurl=\"$remoteurl/\"\n \t\t\t;;\n \t\t*)\n \t\t\tbreak;;\n \t\tesac\n \tdone\n-\techo \"$remoteurl/${url%/}\"\n+\techo \"$remoteurl${url#[/:]}\"\n }\n \n #\n-- \n1.7.0.91.g310a\n\n"},{"id":"135713","messageId":"4B872C06.50502@gmail.com","threadId":"22826","inReplyTo":"1267126109-14638-1-git-send-email-jacob.helwig@gmail.com","subject":"Re: [PATCH] submodule: Improve handling of relative submodule URLs.","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2010-02-26T02:03:50Z","receivedAt":"2010-02-26T02:03:50Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"On 02/25/2010 02:28 PM, Jacob Helwig wrote:\n> Relative URLs only worked with<proto>://<host>/<location>  style URLs, and\n> would break when cloning a repository using<user>@<host>:<location>  (scp)\n> style \"URL\"s.\n>\n> When a submodule's URL was set to \"../submodule.git\", and the repository\n> using it was cloned from \"git@example.com:repo.git\", git would try to\n> clone the submodule from \"git@example.com:repo.git/submodule.git\", which\n> would not likely work.\n>    \nMy solution for this has been to always give the full path, possibly using ~\n\ne.g.,     git@example.com:~/repo.git\n\nand as that works fine, I'm indifferent to this proposed change.\n\nMark\n"}]}