Re: [PATCH v7 6/9] submodule: fix detection of invalid submodule URL
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- May 28, 2012, 19:01 UTC
- Message-ID
- <4FC3CB7E.6000501@kdbg.org>
- In-Reply-To
- <1338132851-23497-7-git-send-email-jon.seymour@gmail.com>
Am 27.05.2012 17:34, schrieb Jon Seymour:
Show 24 quoted lines
> diff --git a/git-submodule.sh b/git-submodule.sh
> index dbbc905..2550681 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -37,23 +37,42 @@ resolve_relative_url ()
> remoteurl=$(git config "remote.$remote.url") ||
> remoteurl=$(pwd) # the repository is its own authoritative upstream
> url="$1"
> - remoteurl=${remoteurl%/}
> - sep=/
> + remoteurl="${remoteurl%/}"
> +
> + case "$remoteurl" in
> + *//*/*)
> + variant="${remoteurl#*//*/}"
> + ;;
> + *::*)
> + variant="${remoteurl#*::}"
> + ;;
> + *:*)
> + variant="${remoteurl#*:}"
> + ;;
> + /*)
> + variant="${remoteurl#/}"Without understanding in detail what this series is about, I would guess that the previous two case arms are not very Windows friendly. Does the right thing happen when $remoteurl is "c:/path/to/remote"? Would it help to use is_absolute_path?
if is_absolute_path "$remoteurl"
then
variant="${remoteurl#*/}"
else
case "$remoteurl" in
...other cases go here...
esac
fi-- Hannes